similar to: form_for and partials

Displaying 20 results from an estimated 10000 matches similar to: "form_for and partials"

2009 Feb 06
2
Using partials with form_for
hi all i was wondering whether it is possible to use partials along with form_for and form_field. following code is not working. is there some error or this case is impossible..?? *#new.html.erb* <h1>Enter Details for new Partner:</h1> <% form_for(@partner) do |f| %> <%= render :partial => ''form'', :locals => {:partner => f} %> <p>
2007 Oct 20
14
Problems with form_for and partials
i''m having problem with a form_for situation where i''m trying to DRY out the repeated parts of my forms and put them in common/form and render the form elements via another partial in controller_name/_form. Here''s the first form # app/views/common/form <% form_for ... do |f| -%> <%= render :partial => "params[:controller]/form", :object => f
2011 Sep 13
3
Accessing Rails helper method with_output_buffer
Hi all, I cannot figure out how to correctly use the with_output_buffer helper method (located in ActionView::Helpers::CaptureHelper) inside a custom FormBuilder. Below follows a simplified example. I''m trying to achieve the following behavior in an ERB as suggested in the form_for helper docs in the Rails source: ========== <%= form_for @object, :builder => MyFormBuilder do
2009 Aug 11
5
Dynamic drop-downs in a form_for using AJAX remote_function - Help
Hello - I am fairly new to Ruby on Rails, but feel like I am learning quick. I have what seems to be a fairly unique issue as I cannot find much out there that describes what I''m seeing. Hopefully it''s a very simple fix, and I simply can''t see the forest through all the trees! I am attempting to create 2 related drop-down lists in the same form_for, both using
2011 Apr 25
3
Active Record database time logging
I''ve been having a look through the code responsible for printing how much time was spent in Active Record at the end of an action. My reading of the code + experiments suggests that any database time after the render is not counted. It seems to me that in controller_runtime.rb in Active Record, append_info_to_payload should in fact read def append_info_to_payload(payload) super
2008 Dec 02
4
Am I wrong or is fields_for not working right in Rails 2.2.2
I may be totally wrong about what the fields_for method is supposed to do, but for some reason I thought using it scoped an object around an association. For example, I have a User class and when you''re creating a new user I want to use fields_for to add a BillingAddress to the user like so: <%- fields_for :billing_address do |billing_address_form| -%> <%= render :partial
2008 Apr 06
10
about the form_for ..
question one: is there any select box tag for form_for? now,perhaps i just can use the select or select_tag? question tow: i have a A model,it has one B such as: class A< ActiveRecord::Base belongs_to :B when i use the form_for tag,how can i output the variable name?like this: <%form_for :a,@a,:url=>{:controller=>"a",:action=>"save"} do |f|%>
2011 Mar 01
6
render :collection calling partial with phantom object?
I have two models with a straightforward has_many / belongs_to relationship: class Premise < ActiveRecord::Base has_many :metered_services, :dependent => :destroy ... end class MeteredService < ActiveRecord::Base belongs_to :premise ... end and nested routes to match: Demo::Application.routes.draw do devise_for :users resources :premises do resources :metered_services
2008 Jan 02
6
problem when editing record in polymorphic relation
I have the following three models created applying the polymorphic concept ========================================================================== class SoftwareCi < ActiveRecord::Base has_one :ci, :as => :content end class HardwareCi < ActiveRecord::Base has_one :ci, :as => :content end class Ci < ActiveRecord::Base belongs_to :content, :polymorphic => true end The
2008 Nov 20
5
Couldn't find without an ID
hi friends... my rhtml is for_for_test.rhtml <html> <head> <title>Form_For Tester</title> </head> <body> <% form_for :blog, :url => { :action => ''save'', :id => @blog } do |f| %> Name: <%= f.text_field :blog %> <%= submit_tag ''Save'' %> <% end %> </body>
2010 Sep 28
12
Completed 406 Not Acceptable
After migrating my 2.3.9 app to rails 3.0.0 I get this error: Completed 406 Not Acceptable in 513ms I also noted that processing controller doesn''t output the protocol: -- Processing by Admin::PhotographersController#update as while if it works, say: -- Processing by Admin::PhotographersController#update as HTML Here is the full action output http://pastie.org/1187051 Can
2007 Oct 18
9
with_scope issue
I have the following code: class User < ActiveRecord::Base has_many :requests do def find_active(options = {}) with_scope :find => { :conditions => ["requests.active = ?", true] } do find(:all, options) end end end end Executing user.requests.find_active results in the following SQL: SELECT * FROM requests WHERE (( requests.user_id = 10 ) AND (
2011 Apr 25
30
NoMethodError in Book
I got a following error. NoMethodError in Book#new Showing /home/amrit/boook/app/views/book/_form.html.erb where line #1 raised: undefined method `model_name'' for NilClass:Class The content of _form.html.erb file are: <%= form_for(@post) do |f| %> <% if @post.errors.any? %> <div id="error_explanation"> <h2><%=
2008 Jul 21
6
form_for and select ( => f.select)
Hi All I''m trying to combine the from_for and select helpers Right now I have form_for :service, :url => ...... do |f| select("abc", "xyz_id", @my_arr.collect {|item| [ item, "bla" ] }, {:prompt => "opt1"} ) .... end What I want to do is something like .... f.select("abc", "xyz_id", @my_arr.collect {|item|
2009 Mar 09
4
undefined method `symbol_path'
I am getting following error while creating a new topic using RESTful design. But, everything works fine when I use <% form_tag :action => :create do %> . ActionView::TemplateError (undefined method `symbol_path'' for #<ActionView::Base:0xb72a2e40>) on line #3 of topics/new.rhtml: 1: <h1>New Topic</h1> 2: 3: <% form_tag :topic, :url => topics_path do %>
2011 Aug 02
2
removing instance variables in partials?
Hi, I read some articles about why partials should not have instance variables in them. But in "Ruby on Rails 3 Tutorial" the author starts with this partial: View: <%= form_for(@user) do |f| %> <%= render ''shared/error_messages'' %> Partial: <% if @users.errors.any? %> ... ... I thought removing the @user instance variable from the partial
2008 Nov 22
4
"syntax error, unexpected tIDENTIFIER , expecting kEND" in RJS response
I get a "syntax error, unexpected tIDENTIFIER, expecting kEND" when the following RJS template is rendered: page.insert_html :bottom, :requisite_table, :partial => "insert_jobrequisite_select", :locals => {:job => @job, :counter => @counter} page.alert("hi") The same RJS template is rendered without errors as soon as the rjs file has only one single
2008 Jan 21
8
Polymorphic URL helpers documentation and fixes
Yesterday I answered a question regarding polymorphic URL helpers on Core ML and noticed that the module has no documentation. I''ve documented it and rewritten unit tests using Mocha. I also optimized some of the code slightly (nothing major, though). The patch also includes two fixes by Geoff Buesing, who has done awesome work in this area in the past.
2009 Mar 01
15
Ajax in Rails
Hi All, New to the group, and new to learning rails. I''m having some trouble, i''ve done a few tutorials on creating some small apps with rails and am now starting to play around myself. I''ve been trying to create a simple form which when a user enters any data that data is displayed as a preview elsewhere on the page instantly, just like when creating an advert with
2010 Mar 22
7
How to reference a select_tag within a form
Hi All, Inside my app\views\expenses\new.html.erb file, I had the code: <% form_for(@expense) do |f| %> [snip] <p> <%= f.label :vendor %><br /> <%= f.text_field :vendor %> <br /> <div id="vendor_droplist> <%= select_tag "test", options_for_select(@current_vendors.collect { |v| v.nickname }), {:multiple