ruby-on-rails-3.2

how to submit 2 forms with one button rails 3

让人想犯罪 __ 提交于 2020-01-05 05:41:29
问题 I want to submit two forms with a single button. Below if my code :- rate.rb belongs_to :target, :polymorphic => true belongs_to :location location.rb has_many :rates event.rb has_many :rates, :as => :target form.html.haml = form_for [@event, @rate] do |form| %ul %li= form.radio_button :rate, "Excellent" %li Excellent %li= form.radio_button :rate, "Okay" %li Okay %li= form.radio_button :rate, "Poorly organized" %li Poorly organized %li= form.radio_button :rate, "Didn't happen" %li Didn't

how to submit 2 forms with one button rails 3

偶尔善良 提交于 2020-01-05 05:41:05
问题 I want to submit two forms with a single button. Below if my code :- rate.rb belongs_to :target, :polymorphic => true belongs_to :location location.rb has_many :rates event.rb has_many :rates, :as => :target form.html.haml = form_for [@event, @rate] do |form| %ul %li= form.radio_button :rate, "Excellent" %li Excellent %li= form.radio_button :rate, "Okay" %li Okay %li= form.radio_button :rate, "Poorly organized" %li Poorly organized %li= form.radio_button :rate, "Didn't happen" %li Didn't

getting data using jquery getJSON in ruby on rails

坚强是说给别人听的谎言 提交于 2020-01-04 09:05:26
问题 i am trying to get amount of a bill through getJSON method. Though i am getting the amount, i am not able to post it. The code is as follows. in the form <div class="bill"> <%= f.collection_select :customer_bill_id, CustomerBill.all,:id,:id, {:prompt => "Select Customer bill"} %></div><br /> <div class= "due"><%= f.input :bill_due_amount, :label => "Bill Due Amt.", :input_html => { :size => 20} %> </div><br /> the js jQuery(".bill select").bind("change", function() { var data = { customer

getting data using jquery getJSON in ruby on rails

心不动则不痛 提交于 2020-01-04 09:05:12
问题 i am trying to get amount of a bill through getJSON method. Though i am getting the amount, i am not able to post it. The code is as follows. in the form <div class="bill"> <%= f.collection_select :customer_bill_id, CustomerBill.all,:id,:id, {:prompt => "Select Customer bill"} %></div><br /> <div class= "due"><%= f.input :bill_due_amount, :label => "Bill Due Amt.", :input_html => { :size => 20} %> </div><br /> the js jQuery(".bill select").bind("change", function() { var data = { customer

Ruby on Rails 3.2 compiled assets are not working

三世轮回 提交于 2020-01-03 17:30:50
问题 Is this a bug in Rails' asset? I don't see what I am doing wrong. Can you please help? I don't want to do on-demand compiling... The bug: Started GET "/" for 127.0.0.1 at 2012-02-02 01:25:44 +0200 Processing by StaticPagesController#home as HTML Rendered static_pages/home.html.erb within layouts/application (11.8ms) Rendered layouts/_stylesheets.html.erb (3.1ms) Completed 500 Internal Server Error in 33ms ActionView::Template::Error (blueprint/screen.css isn't precompiled): 1: <!--[if lt IE 9

NoMethodError: Undefined method 'type' for nil:NilClass in Rails

南楼画角 提交于 2020-01-03 17:27:30
问题 Getting a NoMethodError when trying to load up one of the pages on my website built with Rails. See the full stack trace below. If I change false to true in production.rb at line config.cache_classes = false then the problem goes away, but I have to restart the Rails server every time I make a change to any file. It seems like the problem is related to checking the type of a column in my DB, but I can't figure out how to resolve it. Controller action: def manage @view_data = {} if (@view_data

Rails 3.2 and Sass not rendering Application.css

谁都会走 提交于 2020-01-03 17:26:19
问题 I just did a major upgrade to Rails 3.2 and the newest Sass and Coffee Rails Gems, but my Application file won't render as Application.css.scss. I had it in my html as such: <%= stylesheet_link_tag 'application.css.scss' %> And when I look at the Page Source in my Development mode I'm getting <link href="/assets/application.css.scss.css" media="screen" rel="stylesheet" type="text/css" /> What the heck is going on!? It seems to append .css to everything I put inside the stylesheet_link_tag, so

Rails Devise Polymorphic - Get Render Partial Using Ajax

☆樱花仙子☆ 提交于 2020-01-03 10:05:10
问题 I have implement devise registration with multiple model from this answer. This tuts get params user_type from path. I want to change this with select user_type . So a param user_type will get when I select a value on select_tag . I have some code looks like : routes.rb namespace :cp do devise_scope :user do match '/add_user' => 'registrations#new' match '/select/admin' => 'registrations#selectuser', :user => { :usertype => 'admin' } match '/select/player' => 'registrations#selectuser', :user

How to make a check_box checked in rails?

好久不见. 提交于 2020-01-03 06:45:19
问题 I made checkboxes using the following rails form helper: <%= check_box("tag", tag.id) %> However, I need to make some of them checked by default. The rails documentation doesn't specify how to do this. Is there a way? How? 回答1: This has a very straightforward solution that is directly supported by check_box (at least as of rails 4, I didn't check older documentation) <%= check_box("tag", tag.id, {checked: true}) %> This will make the checkbox checked. Of course instead of true you will put in

Ruby on Rails receiving Internal Server Error: expected Array (got String) for param

拜拜、爱过 提交于 2020-01-03 06:17:19
问题 I have a loop in a form and I'm trying to create multiple data with same name but I'm getting an error with my syntax. I had another question to the same application HERE where I had a mass-assignment error because of the numbers in the array <%= form_for [@hourable, @hour] do |f| %> <% (1..7).each do |i| %> <%= select_tag "hour[#{i}][day]", options_for_select(days_hours) %> <%= select_tag "hour[#{i}][open_time]", options_for_select([ ... %> <%= select_tag "hour[#{i}][open_time]", options_for