[Rails] Re: form_for with url and params

2017-04-23 Thread Manish Shah
You can't have multiple objects for a form_for, it can only be one. If you want to do a subobject, a fields-for is available. On Tuesday, April 4, 2017 at 7:00:20 PM UTC-4, fugee ohu wrote: > > <%= form_for[@user, @address], :url => users_addresses_set_current_path( > current_user.id, a.id) do

[Rails] Re: form_for not rendering :html => {}

2016-01-28 Thread Mendel Schneerson
Sorry I put the wrong line of HTML, the form works: Here it is in Chrome What is interesting is that in Firefox the tag shows up and works fine: -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" g

Re: [Rails] Re: form_for @object with carrierwave upload form

2016-01-22 Thread fugee ohu
This is a broader issue than just file uploads anyway so I need to learn this, if you read the link I posted they make carrierwave sound good so i wanna get comfortable with using it On Friday, January 22, 2016 at 9:20:04 PM UTC-5, Przemek Kosakowski wrote: > > Are you using Paperclip or other

[Rails] Re: form_for @object with carrierwave upload form

2016-01-22 Thread fugee ohu
On Thursday, January 21, 2016 at 11:16:40 PM UTC-5, fugee ohu wrote: > > This form raises undefined method `pictures_path' for > #<#:0xbb9cb4c> > > <%= form_for(@picture, :html => { :multipart => true }) do |f| %> > > > <%= f.file_field :image %> > > > <%= f.submit %> > > <% end %> > >

Re: [Rails] Re: form_for @object with carrierwave upload form

2016-01-22 Thread fugee ohu
I'm using carrierwave In my controller I can test for the presence of params[profile_id] and then i would know the value of imageable_type should be set to profile but how do i pass a value for imageable_id ? On Friday, January 22, 2016 at 9:20:04 PM UTC-5, Przemek Kosakowski wrote: > > Are you

Re: [Rails] Re: form_for @object with carrierwave upload form

2016-01-22 Thread Przemek Kosakowski
Are you using Paperclip or other gem ? I'm asking because Paperclip resolved this issue and you don't have think about this other fields and values. W dniu 23.01.2016 o 03:17, fugee ohu pisze: How do i get the values for imageable_id and imageable_type inserted into a new picture object? i ca

[Rails] Re: form_for @object with carrierwave upload form

2016-01-22 Thread fugee ohu
How do i get the values for imageable_id and imageable_type inserted into a new picture object? i can put imageable_type as a hidden field, but imageable_id i don't know On Thursday, January 21, 2016 at 11:16:40 PM UTC-5, fugee ohu wrote: > > This form raises undefined method `pictures_path' for

[Rails] Re: form_for @object with carrierwave upload form

2016-01-22 Thread fugee ohu
On Thursday, January 21, 2016 at 11:16:40 PM UTC-5, fugee ohu wrote: > > This form raises undefined method `pictures_path' for > #<#:0xbb9cb4c> > > <%= form_for(@picture, :html => { :multipart => true }) do |f| %> > > > <%= f.file_field :image %> > > > <%= f.submit %> > > <% end %> >

[Rails] Re: form_for @object with carrierwave upload form

2016-01-22 Thread fugee ohu
On Thursday, January 21, 2016 at 11:16:40 PM UTC-5, fugee ohu wrote: > > This form raises undefined method `pictures_path' for > #<#:0xbb9cb4c> > > <%= form_for(@picture, :html => { :multipart => true }) do |f| %> > > > <%= f.file_field :image %> > > > <%= f.submit %> > > <% end %> > >

[Rails] Re: form_for @object with carrierwave upload form

2016-01-22 Thread fugee ohu
On Thursday, January 21, 2016 at 11:16:40 PM UTC-5, fugee ohu wrote: > > This form raises undefined method `pictures_path' for > #<#:0xbb9cb4c> > > <%= form_for(@picture, :html => { :multipart => true }) do |f| %> > > > <%= f.file_field :image %> > > > <%= f.submit %> > > <% end %> > >

Re: [Rails] Re: form_for @object with carrierwave upload form

2016-01-22 Thread fugee ohu
On Friday, January 22, 2016 at 6:11:34 AM UTC-5, Przemek Kosakowski wrote: > > Many pictures for user profile ? I can't agree but okay. If you have many > pictures for one user then you should create Gallery model instead of > Picture. Even on fb user be able to have only one profile picture. >

Re: [Rails] Re: form_for @object with carrierwave upload form

2016-01-22 Thread Przemek Kosakowski
Many pictures for user profile ? I can't agree but okay. If you have many pictures for one user then you should create Gallery model instead of Picture. Even on fb user be able to have only one profile picture. But I don't judge, maybe your solution is effective. W dniu 22.01.2016 o 12:06, fu

Re: [Rails] Re: form_for @object with carrierwave upload form

2016-01-22 Thread fugee ohu
On Friday, January 22, 2016 at 6:01:33 AM UTC-5, Przemek Kosakowski wrote: > > many pictures you mean "a few different user profile photo" or you mean > "few copy of the same picture but different size/dimension" ? > > W dniu 22.01.2016 o 11:59, fugee ohu pisze: > > On Thursday, January 21, 2016 a

Re: [Rails] Re: form_for @object with carrierwave upload form

2016-01-22 Thread Przemek Kosakowski
many pictures you mean "a few different user profile photo" or you mean "few copy of the same picture but different size/dimension" ? W dniu 22.01.2016 o 11:59, fugee ohu pisze: On Thursday, January 21, 2016 at 11:16:40 PM UTC-5, fugee ohu wrote: This form raises |undefined method `picture

[Rails] Re: form_for @object with carrierwave upload form

2016-01-22 Thread fugee ohu
On Thursday, January 21, 2016 at 11:16:40 PM UTC-5, fugee ohu wrote: > > This form raises undefined method `pictures_path' for > #<#:0xbb9cb4c> > > <%= form_for(@picture, :html => { :multipart => true }) do |f| %> > > > <%= f.file_field :image %> > > > <%= f.submit %> > > <% end %> > >

[Rails] Re: <%= form_for(@listing) do |f| %> prepends model name to fields

2015-12-02 Thread fugee ohu
actually it prepends in singular listing_title, listing_description, etc On Thursday, December 3, 2015 at 2:04:19 AM UTC-5, fugee ohu wrote: > > Why does <%= form_for(@listing) do |f| %> the form helpers f.select, > f.label, f.text_field, f.checkbox, f.radio_button all prepend model names > to

Re: [Rails] Re: form_for not passing id?

2014-11-04 Thread BalaRaju Vankala
Hey Dave, Before any controller action use "raise params.inspect ", you will get parameters coming from Form. You have to use that parameters only . In your case just add this line in edit action (Edit Method) "raise params.inspect". you will get all parameters. On Mon, Nov 3, 2014 at 7:19 PM,

[Rails] Re: form_for not passing id?

2014-11-03 Thread Dave Castellano
Matt Jones wrote in post #1161637: > On Sunday, 2 November 2014 20:57:43 UTC-5, Ruby-Forum.com User wrote: >> ... >> <%= f.submit 'Update', :class => 'btn btn-primary' %> >> ... >> <% end %> >> >> @profile contains # as it should. >> >> routes contains: resources :profiles and

[Rails] Re: form_for not passing id?

2014-11-03 Thread Matt Jones
On Sunday, 2 November 2014 20:57:43 UTC-5, Ruby-Forum.com User wrote: > > Hi, > When I try to update a field using the update button I am getting the > error: No route matches [PATCH] "/profile". Its obviously missing the > /:id but I can't figure out why... > > I am using a form_for in an e

[Rails] Re: form_for not passing id?

2014-11-03 Thread Dave Castellano
sampath n. wrote in post #1161624: > Form_for will get the :id by default. which version are you using and > please paste the controller code here. tks > > On Mon, Nov 3, 2014 at 10:16 AM, BalaRaju Vankala > Rails 4.0.3 Controller code: def edit @banner_title = "Edit Profile" @profile =

[Rails] Re: form_for (or erb) is pulling floats instead of ints in ActiveRecord

2014-02-12 Thread Cris Shupp
Fred, Thanks for the interest: [#, #, //Cris -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails

[Rails] Re: form_for (or erb) is pulling floats instead of ints in ActiveRecord

2014-02-12 Thread Frederick Cheung
On Tuesday, February 11, 2014 4:46:41 PM UTC, Ruby-Forum.com User wrote: > My team is currently upgrading a rails app from 3.2.3 to 4.0 with JRuby > 1.7.10 backed by Oracle. Under Rails 3.2.3 everything is nice and > happy... > > We have a model called JobMetadata and every numeric column is

[Rails] Re: form_for instance model help; move logic from form to controller

2013-06-09 Thread andreo
so if in your action you do @relationship = current_user.relationships.build(followed_id: @user.id) you should have a variable called relationship on your view: <%= form_for(relationship) do |f| %> <%= f.hidden_field :followed_id %> <%= f.submit "Follow", class: "btn btn-large btn-primary"

[Rails] Re: form_for with nested resources expects different path

2013-01-03 Thread Dave Dolan
I'm having this same problem. did you ever get this resolved? On Wednesday, April 18, 2012 1:23:07 PM UTC-4, Everton Cardoso wrote: > > Hi guys, I have a problem with form_for helper method. > > > Scenario: > > My models > > > > Org::Organization and Org::Member > > > routes.rb >

[Rails] Re: form_for with multiple objects, each with a preset attribute?

2012-11-24 Thread elioncho
This was really useful. Thanks for leaving info on how you did it. On Wednesday, May 13, 2009 1:43:10 AM UTC-5, Jacob Patton wrote: > > I'm using Rails to create a schedule of a shop's opening and closing > hours. Simplified versions of the models I've set up is: > > class Account < ActiveRecor

[Rails] Re: form_for with module and namespace

2012-07-31 Thread Marcelo Junior
Issue resolved: http://stackoverflow.com/questions/11713427/form-for-with-module-and-namespace -- Posted via http://www.ruby-forum.com/. -- 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 rubyonrails-t

[Rails] Re: form_for with module and namespace

2012-07-30 Thread Marcelo Junior
With the resources :bill_recs, :path => '/finance' ... and scope "/finance" do ... it appears a message: ActionController::RoutingError (uninitialized constant BillRecOffController): I need to put the models into a namespace beacause there are many files in my project, then Finance::BillRec

[Rails] Re: form_for with module and namespace

2012-07-29 Thread Marcelo Junior
rake routes: finance_bill_rec_bill_rec_offs GET /finance/bill_recs/:bill_rec_id/bill_rec_offs(.:format) finance/bill_rec_offs#index POST /finance/bill_recs/:bill_rec_id/bill_rec_offs(.:format) finance/bill_rec_offs#create new_finance_bill_rec_bill_rec_off GE

[Rails] Re: form_for reset button doesn't get updated to new form values after AJAX update

2012-06-27 Thread A L
And hopefully something simpler than looping through all the fields and manually setting their default values: http://stackoverflow.com/questions/8767048/how-can-i-update-a-default-value-for-a-form-field-after-an-ajax-submission-not -- You received this message because you are subscribed to the

[Rails] Re: form_for not rendering

2012-05-09 Thread Paulo Carvalho
Thanks a lot for your help. This little "=" was missing and I was not able to see it. Best regards. Colin Law wrote in post #1060124: > On 9 May 2012 11:08, Paulo Carvalho wrote: >> [code] >> view_by :id, >> [quote] >> end >> <% form_for @author do |f| %> > Try <%= form_for ... > > If that sti

[Rails] Re: form_for text_field

2011-11-03 Thread st 121212
And also I had detected that if I change def escape_once(html) ActiveSupport::Multibyte.clean(html.to_s).gsub(/[\"><]|&(?!([a-zA-Z\u00C0-\u00FF]+|(#\d+));)/) { |special| ERB::Util::HTML_ESCAPE[special] } end method in c:\Ruby187\lib\ruby\gems\1.8\gems\actionpack-2.3.5\lib\

[Rails] Re: form_for text_field

2011-11-02 Thread st 121212
Frederick Cheung wrote in post #1029736: > > I'd start by checking that you are using the same encoding throughout > the app (the encoding advertised to the browser, database connection > encoding, encoding of the table/columns etc) or funny things will > happen. For example if you try and insert i

[Rails] Re: form_for routing issue

2011-06-30 Thread Ajit
It seems like you already have a member. Post works for create. you should be using Put.. because it seems like an update. Ajit On Jun 30, 10:34 am, Erwin wrote: > I defined a renew route for membership resources as following : > >     scope 'users' do >       >       resources :membership

[Rails] Re: form_for checkbox with array

2011-05-23 Thread Alpha Blue
I've read what you posted and I'm still not sure what you are trying to do here. Start out by providing the following and use (http://gist.github.com) for posting the code for readability. Model Files: post your user.rb and profile.rb Schema: post your schema for user and profile Controller Fil

[Rails] Re: form_for checkbox with array

2011-05-23 Thread Tim Shaffer
When you do f.check_box(:i) Rails expects the model for the form instance (in this case, User) to have an attribute called "i". You can use the "check_box_tag" helper to generate a check box that is not tied to a model. -- You received this message because you are subscribed to the Google Grou

[Rails] Re: Form_for submit to a different table

2011-05-19 Thread Saravanan Krishnan
DC, Try this, http://www.railsforum.com/viewtopic.php?id=717 Use form_tag instead form_for Saravanan K http://bit.ly/9NpP7e -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this gro

Re: [Rails] Re: form_for, need to modify the :url based on if it is persisted or not

2011-05-07 Thread Frederick Cheung
On 7 May 2011, at 02:04, S Ahmed wrote: > Thanks. > > When you add something to a helper like articles_helper, does it have the > request object in there also? > > How does it get the @articles object when I call it like: > Controller instance variables are copied across to the view objec

Re: [Rails] Re: form_for, need to modify the :url based on if it is persisted or not

2011-05-06 Thread S Ahmed
Thanks. When you add something to a helper like articles_helper, does it have the request object in there also? How does it get the @articles object when I call it like: form_for @article, correct_post_path, ... I would have though it would be: form_for @article, correct_post_path(@article), .

[Rails] Re: form_for, need to modify the :url based on if it is persisted or not

2011-05-05 Thread Eugen Ciur
You can create a helper method (in helpers/articles_helper.rb): def correct_post_path @article.persisted? comment_article_path : articles_path end And then use this helper in your form builder form_for @article, correct_post_path do ... end That helps ? Maybe you can tell us under what co

[Rails] Re: form_for, need to modify the :url based on if it is persisted or not

2011-05-05 Thread Tim Shaffer
It can certainly be done easy enough, but I'd question the problem you are trying to solve if you want to do something like that. -- 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 rubyonrails-talk@googl

[Rails] Re: Form_for problem after upgrading

2010-11-03 Thread tashfeen.ekram
solution found. there is apparently a conflict with an older version of haml. https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/5493 install haml 3.0.18 or higher to resolve. On Nov 3, 7:54 pm, "tashfeen.ekram" wrote: > Any ideas? Below is the dev log when i load that page. no

[Rails] Re: Form_for problem after upgrading

2010-11-03 Thread tashfeen.ekram
even when i add random text with the form liek "Email" as below is not even outputted. it is as if the whole blcok is being ignored... <%= form_for @user_session, :url => user_session_path do |f| %> Email <%= text_field_tag :login %> Password <%= f.password_field :password %> Rem

[Rails] Re: Form_for problem after upgrading

2010-11-03 Thread tashfeen.ekram
Any ideas? Below is the dev log when i load that page. none of the below seems to be related. Started GET "/login" for 127.0.0.1 at Wed Nov 03 19:53:35 -0400 2010 DEPRECATION WARNING: Base.named_scope has been deprecated, please use Base.scope instead. (called from /var/www/drugbin/app/models/user

[Rails] Re: form_for .label class

2010-11-01 Thread Marnen Laibow-Koser
Creative Technologist wrote in post #958582: > Hi, > > Could anyone tell me what I'm doing wrong below when trying to apply a > style to the following label and text field > > > <%= f.label :name, :html => {:class => "label"} %> > <%= f.text_field :name, :html => {:class => "label"}

[Rails] Re: Form_for problem after upgrading

2010-10-31 Thread tashfeen.ekram
hmmm... well i installed that plugin however i am still having no luck. form_tag seems to work properly. my dev log does not give me any errors, just some depreciation warning unrelated to this problem. any ideas? On Oct 27, 11:30 am, Ganesh Kathare wrote: > tashfeen.ekram wrote in post #95737

[Rails] Re: Form_for problem after upgrading

2010-10-27 Thread Ganesh Kathare
tashfeen.ekram wrote in post #957373: > I am upgrading to rails 3 and afer diong so, none of my form_for are > working. (I can not actually say not all of them are working but the > few that i have tried are not). The page loads fine but the form is > not output. This is after making the the change

[Rails] Re: Form_for problem after upgrading

2010-10-27 Thread Solrac Caritas
> <%= form_for @user_session, :url => user_session_path do |f| %> > Email > <%= text_field_tag :login %> > Password > <%= f.password_field :password %> > Remember Me > <%= f.check_box :remember_me %> > <%= f.submit "Login" %> > <% end %> replace <%= text_field_tag :login %> with

[Rails] Re: form_for

2010-08-19 Thread MattB
This is a method generated for you by rails as a result of the associtions declared in the Post and Comment models - in this case belongs_to and has_many. Comments belongs to a post, and a post can have many comments. Rails creates quite a number of theses methods in response to the association,

[Rails] Re: form_for arguments

2010-08-15 Thread Abder-Rahman Ali
Rick, Seems this is broken also at your LinkedIn: http://speakerrate.com/speaker/395-rdenatale This is beside "Websites". -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group,

[Rails] Re: form_for arguments

2010-08-15 Thread Abder-Rahman Ali
Rick, Just a small note under "links" at your blog, it seems tht the "Redhanded" is broken. -- Posted via http://www.ruby-forum.com/. -- 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 rubyonrails-t...

[Rails] Re: form_for arguments

2010-08-15 Thread Abder-Rahman Ali
Thanks s lot Rick for this nice explnation. Yes, does make sense. -- Posted via http://www.ruby-forum.com/. -- 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 rubyonrails-t...@googlegroups.com. To unsubs

Re: [Rails] Re: form_for

2010-08-14 Thread clanlaw
On 14 August 2010 15:34, Abder-Rahman Ali wrote: > Frederick Cheung wrote: >> On Aug 14, 2:23�pm, Abder-Rahman Ali wrote: >>> form_for: used to generate a form. >>> @post: the object form_for is bound to. >>> >>> The part I didn't get here is: >>> >>> @post.comments.build >>> >>> What does that p

[Rails] Re: form_for

2010-08-14 Thread Abder-Rahman Ali
Frederick Cheung wrote: > On Aug 14, 2:23�pm, Abder-Rahman Ali wrote: >> form_for: used to generate a form. >> @post: the object form_for is bound to. >> >> The part I didn't get here is: >> >> @post.comments.build >> >> What does that part provide me with? > > It's a namespaced resource - it's a

[Rails] Re: form_for

2010-08-14 Thread Frederick Cheung
On Aug 14, 2:23 pm, Abder-Rahman Ali wrote: > At the following:http://edgeguides.rubyonrails.org/getting_started.html > > Under: 7.4 Generating a Controller > > It mentions the following: > > <%= form_for([...@post, @post.comments.build]) do |f| %> > > Now, this is what I know: > > form_for: use

[Rails] Re: form_for won't generate the correct action path

2010-06-28 Thread richardsugg
Thanks, Bill. I checked out the documentation on REST and it makes much better sense now. On Jun 28, 10:15 am, bill walton wrote: > Hi Richard, > > On Mon, 2010-06-28 at 06:46 -0700, richardsugg wrote: > > I'm really baffled since this should be very textbook: > > > <% form_for :person, :url =>

[Rails] Re: form_for Values Are Not Visible

2010-05-14 Thread David
That would do it. Meanwhile, if you are using form_for, you should do this: <%= f.text_field :first_name %> The f knows it refers to the person record because you told it so with form_for... On May 14, 9:50 am, Joshua Martin wrote: > I feel quite stupid now.. Apparently, I had some JQuery for a

[Rails] Re: form_for success and failure callbacks

2010-05-12 Thread Phil Ostler
Still stuck with this problem. Does no one have any pointers on this? -- Posted via http://www.ruby-forum.com/. -- 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 rubyonrails-t...@googlegroups.com. To u

Re: [Rails] Re: form_for, submit, and parameters disappearing

2010-03-06 Thread Colin Law
On 6 March 2010 18:50, Ralph Shnelvar wrote: > Consider the following: > > - - - > <% form_for @countryToSearchFor, :url => signed_in_path(:action => > "show", >        :id => 'connected_to_country', :something => 'other'), >        :html => {:method => :get} do |f| %> > >  <%= f.select :country,

[Rails] Re: form_for, submit, and parameters disappearing

2010-03-06 Thread Ralph Shnelvar
Consider the following: - - - <% form_for @countryToSearchFor, :url => signed_in_path(:action => "show", :id => 'connected_to_country', :something => 'other'), :html => {:method => :get} do |f| %> <%= f.select :country, language_neutral_array_of_countries, :prompt => 'e

[Rails] Re: form_for ... adding locale

2010-02-16 Thread Ralph Shnelvar
Ralph Shnelvar wrote: > <% form_for @countryToSearchFor, :url => { :action => "show", :id => > "connected_to_country" }, :html => {:method => :get} do |f| %> I hit the dame return key. Ugh. Anyway ... Is this the place I should modify so that when the user hits the submit button associate

[Rails] Re: form_for helper for nested resources

2010-02-16 Thread Seirie
This also works, and seems a lot more elegant: <% form_for [...@course, @discussion, Message.new] do |f| %> On Feb 16, 2:59 am, Seirie wrote: > Ahh, got the first issue as well. For anyone that's interested, I was > able to get my desired result with: > > <% form_for Comment.new, :url => > categ

[Rails] Re: form_for helper for nested resources

2010-02-16 Thread Seirie
Ahh, got the first issue as well. For anyone that's interested, I was able to get my desired result with: <% form_for Comment.new, :url => category_post_comments_path(:category_id => @category, :post_id => @post) do |f| %> On Feb 16, 2:41 am, Seirie wrote: > Alright, I figured out the second iss

[Rails] Re: form_for helper for nested resources

2010-02-15 Thread Seirie
Alright, I figured out the second issue there, I needed to pass in a reference to the course in question: <%= link_to book_pages_path(@book) %> Man I'm losing it, time for bed, lol. On Feb 16, 2:24 am, Seirie wrote: > Hmmm, maybe I'm thinking about this all wrong. It seems like its grown > into

[Rails] Re: form_for helper for nested resources

2010-02-15 Thread Seirie
Hmmm, maybe I'm thinking about this all wrong. It seems like its grown into an even bigger issue now. If I try to access a nested route from it's parent resource, I cant. I'll give you an example: If I try to use <%= link_to book_pages_path %> from a page with the URL of "books/1", I get an error

[Rails] Re: form_for url.. how to send data to another controller

2009-10-11 Thread erwin
thanks .. got it.. see my answer to Colinthe doc info is not obvious... I had to read between lines and test test test ...many different options to watch the generated htmlbut it works well now... ( I keep the 'recipe' in my NoteTaker ;-))) On 10 oct, 20:18, Cris Shupp wrote:

[Rails] Re: form_for url.. how to send data to another controller

2009-10-11 Thread erwin
Thanks Colin... I looked into it in parallel ... not obvious but I found the solution (many tries.. as it's not the 'standard' way.. but I'm just writing a quick app draft) <% form_for :tutor, @tutor, :url => { :action => "create" } for new/create records <% form_for :tutor, @tutor, :url

[Rails] Re: form_for url.. how to send data to another controller

2009-10-10 Thread Cris Shupp
Erwin, If I understand what you are trying to do then I was trying to solve a similar but lesser problem. How to send form data from one method in a controller to another method in the same controller Iit does seem to work for your case though). Here is a sample erb: gather.html.erb Gatheri

[Rails] Re: form_for url.. how to send data to another controller

2009-10-10 Thread Colin Law
2009/10/10 Erwin : > > @trainee is an instance of User class > > my form partial code : > > <% form_for :@trainee, :html => {:class => 'generalform'} do |form| %> >        <%= render :partial => "form", :object => form %> >         <%= form.submit "Register", :class => 'go' %> <%= link_to > 'Cance

[Rails] Re: Form_for with namespace

2009-10-07 Thread Bryan L
To anyone who is experiencing this problem, there's a patch to rectify this already. https://rails.lighthouseapp.com/projects/8994/tickets/3144-undefined-method-for-string-ror-234 The latest master branch at github should fix this too! Phew... On Oct 7, 2:42 am, Colin Law wrote: > 2009/10/6 Br

[Rails] Re: Form_for with namespace

2009-10-06 Thread Colin Law
2009/10/6 Bryan L : > > On Oct 6, 11:19 pm, Colin Law wrote: >> I think a lot of people have had this problem, I believe it is a known >> bug in Rails 2.3.4.  I understand the easiest solution is to go down >> to 2.3.3 if possible. >> Colin >> > > What about generating normal forms? I can't seem

[Rails] Re: Form_for with namespace

2009-10-06 Thread Bryan L
On Oct 6, 11:19 pm, Colin Law wrote: > I think a lot of people have had this problem, I believe it is a known > bug in Rails 2.3.4.  I understand the easiest solution is to go down > to 2.3.3 if possible. > Colin > What about generating normal forms? I can't seem to do it without errors. <% for

[Rails] Re: Form_for with namespace

2009-10-06 Thread Colin Law
2009/10/6 Bryan L : > > Thanks Coiln. I deleted that message actually because it slipped my > mind that the line which I defined @design as a Design model got > deleted off when I regenerated the controllers and models. I fixed > that already so now I'm stuck with another different undefined metho

[Rails] Re: Form_for with namespace

2009-10-06 Thread Bryan L
Thanks Coiln. I deleted that message actually because it slipped my mind that the line which I defined @design as a Design model got deleted off when I regenerated the controllers and models. I fixed that already so now I'm stuck with another different undefined method error: undefined method `^'

[Rails] Re: Form_for with namespace

2009-10-06 Thread Colin Law
2009/10/6 Bryan L : > > My bad.. I regenerated the controllers and models and the previous > error seemed to be gone but now I'm getting this error instead: > > Called id for nil, which would mistakenly be 4 -- if you really wanted > the id of nil, use object_id > > If I understand correctly, this

[Rails] Re: Form_for with namespace

2009-10-06 Thread Bryan L
My bad.. I regenerated the controllers and models and the previous error seemed to be gone but now I'm getting this error instead: Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id If I understand correctly, this statement "<% form_for([:admin, @

[Rails] Re: Form_for with namespace

2009-10-06 Thread Bryan L
Thanks Sijo for the help. I've made the changes according to your suggestions. The error message is now different, but I guess there's some improvement! "undefined method `^' for "f":String" My routes.db: map.namespace(:admin) do |admin| admin.resources :designs end Any idea

[Rails] Re: Form_for with namespace

2009-10-06 Thread Sijo kg
Hi Bryan L wrote: > This is what I have in my routes.rb: > map.with_options(:namespace => "admin") do |admin| > admin.resources :designs > end You have to modify your routes as map.namespace(:admin) do |admin| admin.resources :designs end And also generate controller and model li

[Rails] Re: form_for issue

2009-09-04 Thread heimdull
If you want to go to a different page from the update action just add a redirect_to list_translations_url or something like that after the flash[:notice] Your route.rb looks correct On Sep 4, 8:21 am, manaus wrote: > maybe I found the cause, routes.rb has > map.resources :houses --~--~-

[Rails] Re: form_for issue

2009-09-04 Thread manaus
maybe I found the cause, routes.rb has map.resources :houses --~--~-~--~~~---~--~~ 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 rubyonrails-talk@googlegroups.com To uns

[Rails] Re: form_for issue

2009-09-04 Thread manaus
Ar Chron wrote: > Where the user goes after a create or update is the controller's > decision... Here is the controller action... def update @house = House.find(params[:id]) if @house.update_attributes(params[:house]) flash[:notice] = "Traduzione salvata" end end

[Rails] Re: form_for issue

2009-09-04 Thread Ar Chron
Where the user goes after a create or update is the controller's decision... -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this gr

[Rails] Re: form_for help needed

2009-08-12 Thread Greg Donald
On Wed, Aug 12, 2009 at 9:59 AM, bill walton wrote: > I haven't used Chrome but it's > difficult to believe that there aren't tools equivalent to Firebug, Live > Http Headers, etc. to assist developers targeting that platform.  If > there aren't The nightly PPA Chrome builds do provide some fairl

[Rails] Re: form_for help needed

2009-08-12 Thread bill walton
On Wed, 2009-08-12 at 07:00 +0200, Rails List wrote: > I guess, we have to assume that the http verb being used by chrome > appear to be 'GET' rather than 'POST'. You shouldn't have to assume anything. I haven't used Chrome but it's difficult to believe that there aren't tools equivalent to F

[Rails] Re: form_for help needed

2009-08-11 Thread Rails List
Wap Addon, thanks for your suggestions. But they are not working. Are they working for you?. Did you try it in Chrome for this or any of your rails app? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are

[Rails] Re: form_for help needed

2009-08-11 Thread Wap Addon
<% form_for :classified, :url=>{ :controller=>'classifieds', :action=>'create'}, :html => { :multipart => true } do |f| %> <%= error_messages_for 'classified' %> <%= submit_tag 'Post' %> <% end %> write like this no for <% form_for(@classified, :html => { :multipart => true }) do |f| %> this

[Rails] Re: form_for help needed

2009-08-11 Thread Rails List
Wap Addon wrote: > > <% form_for :classified, @classified, :url=>{ > in this not both required remove @classified and try to run it No change even after trying with <% form_for(@classified, :html => { :multipart => true }) do |f| %> -- Posted via http://www.ruby-forum.com/. --~--~-~--

[Rails] Re: form_for help needed

2009-08-11 Thread Wap Addon
<% form_for :classified, @classified, :url=>{ in this not both required remove @classified and try to run it -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails:

[Rails] Re: form_for help needed

2009-08-11 Thread Rails List
I tried this again with scaffold. When the validation is triggered, Chrome executes index action at the background (right click your browser and view source). I guess, we have to assume that the http verb being used by chrome appear to be 'GET' rather than 'POST'. Has anyone encountered simil

[Rails] Re: form_for

2009-08-05 Thread Nicholas Henry
And please post the form_for code. Thank you. On Wed, Aug 5, 2009 at 3:33 AM, Conrad Taylor wrote: > On Tue, Aug 4, 2009 at 9:34 PM, Md Fisa > wrote: >> >> Nicholas Henry wrote: >> > You need to move the :onclick => "ValidateForm()" to :onsubmit => >> > "ValidateForm()" in the form_for line. Th

[Rails] Re: form_for

2009-08-05 Thread Conrad Taylor
On Tue, Aug 4, 2009 at 9:34 PM, Md Fisa wrote: > > Nicholas Henry wrote: > > You need to move the :onclick => "ValidateForm()" to :onsubmit => > > "ValidateForm()" in the form_for line. Then when the ValidateForm > > returns false it will halt submission of the form. > > > > You might want to cons

[Rails] Re: form_for

2009-08-04 Thread Md Fisa
Nicholas Henry wrote: > You need to move the :onclick => "ValidateForm()" to :onsubmit => > "ValidateForm()" in the form_for line. Then when the ValidateForm > returns false it will halt submission of the form. > > You might want to consider using something like this: > http://www.livevalidation.

[Rails] Re: form_for

2009-08-04 Thread Conrad Taylor
On Tue, Aug 4, 2009 at 7:16 AM, Conrad Taylor wrote: > On Tue, Aug 4, 2009 at 4:38 AM, Md Fisa > wrote: > >> >> hi everybody... >>I have a form_for in that, onclicking submit button i am calling >> a javascript for validation.If validation fails that form_for doesnt do >> anything.But e

[Rails] Re: form_for

2009-08-04 Thread Conrad Taylor
On Tue, Aug 4, 2009 at 4:38 AM, Md Fisa wrote: > > hi everybody... >I have a form_for in that, onclicking submit button i am calling > a javascript for validation.If validation fails that form_for doesnt do > anything.But even the validation fails it goes to the controller and > action. >

[Rails] Re: form_for

2009-08-04 Thread Nicholas Henry
You need to move the :onclick => "ValidateForm()" to :onsubmit => "ValidateForm()" in the form_for line. Then when the ValidateForm returns false it will halt submission of the form. You might want to consider using something like this: http://www.livevalidation.com/ There's a Rails plugin as we

[Rails] Re: form_for syntax?

2009-07-20 Thread elliottg
I figured it out. It was directly related to the form_for syntax. I guess that when rails generates the alternative explicit index route. In this case "admin_news_index" vs "admin_news" a more explicit syntax is needed. Instead of this: <% form_for [:admin, @news] do |f| %> I found this solved

[Rails] Re: form_for syntax?

2009-07-20 Thread elliottg
Thanks for the input guys. The "adminl" is a email typo only... Here's a truncated version of my route config. map.namespace :admin do | admin | admin.resources :news, :collection => {:sort => :post} end My tests confirm that news_controller.rb#new is indeed sending out a new @news objec

[Rails] Re: form_for syntax?

2009-07-20 Thread David A. Black
Hi -- On Mon, 20 Jul 2009, s.ross wrote: > > You might consider adding an inflection for news in your config/ > initializers/inflections.rb. That will tell Rails that the plural of > news is news. There are examples in the Rails-generated file. It's already there. I don't think this is actually

[Rails] Re: form_for syntax?

2009-07-20 Thread David A. Black
Hi -- On Mon, 20 Jul 2009, elliottg wrote: > > I have been using this namespaced form_for syntax with no problems: > <% form_for [:admin, @products] do |f| %> > > However, now that I am working with a model and controller called > "news" which has no differentiation between singular and plural.

[Rails] Re: form_for syntax?

2009-07-20 Thread s.ross
You might consider adding an inflection for news in your config/ initializers/inflections.rb. That will tell Rails that the plural of news is news. There are examples in the Rails-generated file. On Jul 20, 2009, at 12:00 PM, elliottg wrote: > > I have been using this namespaced form_for syn

[Rails] Re: form_for resources with :singular specified

2009-07-02 Thread Colin Law
2009/7/1 Bryan Ash : > > I fully suspect that I'm missing the point here somewhere so I promise > I won't be offended if you tell me I'm being daft. > > My application rents equipment ... not equipments.  So I have the > following: > >  map.resources :equipment, :singular => :equipment_instance >

  1   2   >