similar to: Problems with form_for and partials

Displaying 20 results from an estimated 5000 matches similar to: "Problems with form_for and partials"

2012 Sep 08
4
dash symbol
In the example below, what is the dash doing between the class attribute and array: (field_helpers - [:label, :check_box, :radio_button, :fields_for, :hidden_field, :file_field]).each do |selector| -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2010 May 28
8
form helpers don't seem to work with RJS files...
I’ve been spending a great deal of time chasing this problem. Hopefully someone sees something obvious I’m doing wrong. Basically anytime I try to call fields_for from an RJS file or within a partial in the RJS file, I get the following error. My goal is simply to load a partial into a div. The fields in this partial require fields_for though. And that’s where the problem lies.
2009 Oct 15
4
Getting the object in fields_for
I''m using the fields_for helper with accepts_nested_attributes_for The System model has_many children. If I do this in my haml template: -form_for @system do |s| =s.text_field :name -s.fields_for :children do |child_fields| =child_fields.text_field :name all is fine. The fields_for iterates over all children and puts the correct data in the fields. But...what I
2007 Sep 25
21
form_for and partials
I love form_for, but I really hate <% form_for :person, @person, :url => {...} do |f| %> ... <%= render :partial => ''form'', :locals => {''f'' => f} ... <% end %> I''ve been thinking of instead allowing <% form_for :person, @person, :url => {...} do |f| %> ... <%= f.partial ''form''
2007 Jun 27
3
template.expect_render
Trunksters, I just added a couple of methods to ActionView::Base in Spec::Rails (as of r2136) that lets you do this in view examples: describe ''/things/index.html.erb'' do it "should render _thing with a collection of things" do assigns[:things] = things = [Object.new] template.expect_render(:partial => ''thing'', :collection => things)
2007 Aug 14
12
expect_render, why does there need to be a warning
There is a warning on the web site about expect_render and stub_render: "WARNING: expect_render and stub_render, while very useful, act differently from standard Message Expectations (a.k.a. mock expectations), which would never pass calls through to the real object. This can be very confusing when there are failures if you''re not aware of this fact, because some calls will be
2008 Dec 21
1
Form issues : partials + AJAX vs simple JS / separate views + form_fors vs one view and fields_fors
Hi all! I am coding an application that keeps track of request to create college courses. An identified user (logically a faculty member) completes a form indicating the name of the course, the professor in charge, the course''s code, the date and place, the possible coprofessors and TAs and the type of website he or she wants to use as a teaching help (WebCT, Sakai, etc.). I have two
2008 Jan 28
9
Nested matchers
We''re encountering a failure with Mocha 0.5.6. We had this expectation: game_version.expects(:attributes=).with(:game_file => kind_of(GameFile), :game_id => @game.id) This expectation was passing with 0.5.5, but fails with 0.5.6. I added this test to parameter_matcher_acceptance_test.rb, which passes in 0.5.5 and fails in 0.5.6 def test_should_match_nested_parameters
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>
2008 Mar 11
1
view spec on rails questions
Hi I have a couple of questions 1) how do you test the response inside a content_for block I see reference to it in the release notes but dont know where to find it (tried http://rspec.info/rdoc-rails/ ) 2) I dont seem to be able to stub partials in a different directory eg <%= render :partial => "foos/show" %> And I put this in the spec template.stub_render(:partial =>
2008 Jan 08
3
What happened to _form.rhtml partial in rails 2.0??
Just wondering if anyone could point me to a good explanation of why the latest way of doing things does not include using something like _form.html.erb partials in RESTful rails 2.0?? Why did we move away from partials, etc?? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To
2006 Sep 13
1
Net::HTTPResponse
Hello :) I have a problem with the Net::HTTP library... The Net::HTTP library [1] uses a Net::HTTPResponse object for all it''s responses from web servers. This class has many subclasses, such as HTTPSuccess, HTTPRedirecttion, etc. When obtaining a response, the library suggests to check what it is by testing the class of the returned object - using case/when or kind_of? (which it does
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 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|%>
2009 May 12
2
2.3 Nested Model Forms; build new without updating existing
I''m trying to build something similar to a Facebook messaging app, in which the view displays all the messages for a particular thread, with a form box for replying at the bottom of the thread. The problem is that using fields_for generates form fields for each existing record, and for one new record. In this case, there is no need to edit existing messages - just a need to add new
2008 Dec 02
1
form_for with partial using do |@f|
Is it possible to pass this FormBuilder object to a controller and then back to a partial? I have a form rendering a partial that i would like to update with a call to my controller based on user selectable parameters, but when the AJAX comes back, i get this error message because i cannot pass a form builder object between the controller and the view: "undefined method
2005 Dec 27
2
Rewriting FormBuilder
Hi, I want to extend formbuilder to make it output a lable (I know about labeled_form_helper made by technoweenie), my own formating, and a couple of extra tags inside the form attribute. I was easily able to extend form_remote_to. But when I continue to adjust the way elements are handled I don''t know how to continue. I can''t find the method text_field thats should is
2011 Jul 11
2
Pre-populating association
Hello, I think this is an easy one for the average Rails developer but I''m a bit stuck. I''m creating a simple voting app: any user can create a survey, with any number of questions, and other users can then vote by creating a ballot for that survey. Here''s the modeling: class Survey < ActiveRecord::Base has_many :questions has_many :eligibilities has_many
2006 Apr 23
3
custom form builder
In the API docs I found this: "You can also build forms using a customized FormBuilder class. Subclass FormBuilder and override or define some more helpers, then use your custom builder " I couldn''t find any further documentation on this. Where can I read more about this formbuilder class? For starters, where would I define a subclass of this class? TIA, Jeroen --
2012 Jan 20
3
Fields_for adding html (text) for hidden field
Hello all, I''m getting this weird ''<input name value=''2'' type=''hidden'' />'' text printed out in my form. See attached image. I''ve spent too much time trying to figure it out already and it''s not going to stop me from moving on for now. As you can see it''s still very early on. I''m using