i have an error undefined method `stringify_keys!'' for "":String my view is given below <%= form_tag :action => ''resolve_create'', :resolve => @resolve %> <p>resolution:<br /> <%= text_area ''resolve'',''content'', :cols => 40, :rows => 12 %></p> <%= submit_tag "save" %> what is dat error and how can i solve them? can any one help me.... thanks -- Posted via http://www.ruby-forum.com/.
srinivasan sakthivel
2009-Oct-22 08:54 UTC
Re: undefined method `stringify_keys!'' for "":String
hi Give me ur controller code. thanks seenu On Thu, Oct 22, 2009 at 1:54 PM, Ralu rm <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>wrote:> > > i have an error > undefined method `stringify_keys!'' for "":String > > my view is given below > > <%= form_tag :action => ''resolve_create'', :resolve => @resolve %> > <p>resolution:<br /> > <%= text_area ''resolve'',''content'', :cols => 40, :rows => 12 %></p> > > <%= submit_tag "save" %> > > what is dat error and how can i solve them? > can any one help me.... > > thanks > -- > 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
srinivasan sakthivel wrote:> hi > > > Give me ur controller code. > > thanks > seenu > > On Thu, Oct 22, 2009 at 1:54 PM, Ralu rmdef update @ticket = Ticket.find(params[:id]) if @ticket.update_attributes(params[:ticket]) redirect_to :action => ''list'' else redirect_to :action => ''edit'' end end def resolve @ticket = Ticket.find(params[:id]) @category = Category.find(params[:id2]) @urgency = Urgency.find(params[:id3]) @resolve = Resolve.new end def resolve_create @resolve = Resolve.new(params[:resolve1]) if @resolve.save redirect_to :action => ''list'' else redirect_to :action => ''resolve'' end end end this is the part of controller code... -- Posted via http://www.ruby-forum.com/.
srinivasan sakthivel
2009-Oct-22 09:06 UTC
Re: undefined method `stringify_keys!'' for "":String
def resolve_create @resolve = Resolve.new(params[:resolve1]) if @resolve.save redirect_to :action => ''list'' else render :action => ''resolve'' end end u can try the above code............. Thanks seenu. On Thu, Oct 22, 2009 at 2:30 PM, Ralu rm <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>wrote:> > srinivasan sakthivel wrote: > > hi > > > > > > Give me ur controller code. > > > > thanks > > seenu > > > > On Thu, Oct 22, 2009 at 1:54 PM, Ralu rm > > > def update > > @ticket = Ticket.find(params[:id]) > if @ticket.update_attributes(params[:ticket]) > redirect_to :action => ''list'' > else > redirect_to :action => ''edit'' > end > end > def resolve > @ticket = Ticket.find(params[:id]) > @category = Category.find(params[:id2]) > @urgency = Urgency.find(params[:id3]) > @resolve = Resolve.new > end > > def resolve_create > @resolve = Resolve.new(params[:resolve1]) > if @resolve.save > redirect_to :action => ''list'' > else > redirect_to :action => ''resolve'' > end > end > > end > > this is the part of controller code... > -- > 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
srinivasan sakthivel
2009-Oct-22 09:09 UTC
Re: undefined method `stringify_keys!'' for "":String
Otherwise u can try this one def resolve_create @resolve = Resolve.new() @resolve.content = params[:resolve][:content] if @resolve.save redirect_to :action => ''list'' else render :action => ''resolve'' end end Thanks seenu On Thu, Oct 22, 2009 at 2:36 PM, srinivasan sakthivel < seenusss2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> def resolve_create > @resolve = Resolve.new(params[:resolve1]) > if @resolve.save > redirect_to :action => ''list'' > else > render :action => ''resolve'' > end > end > > u can try the above code............. > > Thanks > seenu. > > > > > On Thu, Oct 22, 2009 at 2:30 PM, Ralu rm <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org > > wrote: > >> >> srinivasan sakthivel wrote: >> > hi >> > >> > >> > Give me ur controller code. >> > >> > thanks >> > seenu >> > >> > On Thu, Oct 22, 2009 at 1:54 PM, Ralu rm >> >> >> def update >> >> @ticket = Ticket.find(params[:id]) >> if @ticket.update_attributes(params[:ticket]) >> redirect_to :action => ''list'' >> else >> redirect_to :action => ''edit'' >> end >> end >> def resolve >> @ticket = Ticket.find(params[:id]) >> @category = Category.find(params[:id2]) >> @urgency = Urgency.find(params[:id3]) >> @resolve = Resolve.new >> end >> >> def resolve_create >> @resolve = Resolve.new(params[:resolve1]) >> if @resolve.save >> redirect_to :action => ''list'' >> else >> redirect_to :action => ''resolve'' >> end >> end >> >> end >> >> this is the part of controller code... >> -- >> 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
srinivasan sakthivel wrote:> Otherwise u can try this one > > def resolve_create > @resolve = Resolve.new() > @resolve.content = params[:resolve][:content] > if @resolve.save > redirect_to :action => ''list'' > else > render :action => ''resolve'' > end > end > > Thanks > seenu > > > On Thu, Oct 22, 2009 at 2:36 PM, srinivasan sakthivel <thanks seeenu the error gone... but some problem is der with my program. let me check......... thanks once again... have a gr8 day! -- Posted via http://www.ruby-forum.com/.
> def resolve_create > @resolve = Resolve.new(params[:resolve1]) > if @resolve.save > redirect_to :action => ''list'' > else > redirect_to :action => ''resolve'' > end > endProblem is in parameters arguments... It should be params[:resolve] ....not params[:resolve1]... Thanks Brijesh Shah -- Posted via http://www.ruby-forum.com/.
Brijesh Shah wrote:>> def resolve_create >> @resolve = Resolve.new(params[:resolve1]) >> if @resolve.save >> redirect_to :action => ''list'' >> else >> redirect_to :action => ''resolve'' >> end >> end > Problem is in parameters arguments... > > It should be params[:resolve] ....not params[:resolve1]... > > Thanks > Brijesh Shahno i ahve given resolve1 in view and in controller relove1 so i dont think its the problem with parameters, now i think i ddn use any active record relations here like one- one or one -many... is der any nice link to learn dat easily? -- Posted via http://www.ruby-forum.com/.
Hi Ralu rm> i have an error > undefined method `stringify_keys!'' for "":StringThe reason for this error is in the line> <%= form_tag :action => ''resolve_create'', :resolve => @resolve %>Since this will generate source like action="/controller/resolve_create?resolve=" And in resolve_create what you are trying is> @resolve = Resolve.new(params[:resolve]) > if @resolve.saveHere the error is .Why are you passing :resolve => @resolve ? Sijo -- Posted via http://www.ruby-forum.com/.
Sijo k g wrote:> Hi Ralu rm > >> i have an error >> undefined method `stringify_keys!'' for "":String > > The reason for this error is in the line > >> <%= form_tag :action => ''resolve_create'', :resolve => @resolve %> > > Since this will generate source like > action="/controller/resolve_create?resolve=" > > And in resolve_create what you are trying is >> @resolve = Resolve.new(params[:resolve]) >> if @resolve.save > > Here the error is .Why are you passing :resolve => @resolve ? > > > > Sijothen how can i pass the value resolve which iam getting from the user ? is dat iam going in a rubbish way...??? -- Posted via http://www.ruby-forum.com/.
> <%= form_tag :action => ''resolve_create'', :resolve => @resolve %> > <p>resolution:<br /> > <%= text_area ''resolve'',''content'', :cols => 40, :rows => 12 %></p> > > <%= submit_tag "save" %> >Try below code <%= form_tag :action => ''resolve_create'' do %> <p>resolution:<br /> <%= text_area ''resolve'',''content'', :cols => 40, :rows => 12 %></p> <%= submit_tag "save" %> <%end> -- Posted via http://www.ruby-forum.com/.
Hi Ralu rm That is already there in params[:resolve] Sijo -- Posted via http://www.ruby-forum.com/.
Sorry to butt in guys, i get the feeling you''re going to go round in circles forever. Ralu - if the user types ''foo'' in the text box, params will look like this: params = {:resolve => {:content => "foo"}} In the controller you need to do this: @resolve = Resolve.new(params[:resolve]) which is the same as saying this @resolve = Resolve.new({:content => "foo"}) which in turn, effectively does this @resolve = Resolve.new @resolve.content = "foo" Do you see? Like Sijo says, you don''t need :resolve => @resolve in the form - this is going to break the form by overriding :resolve in your params, effectively deleting the parameter from the text field. It would be better if you sticked to the standard restful scheme and your form looked like this: <% form_for @resolve do |f| %> <p>resolution:<br /> <%= f.text_area ''resolve'',''content'', :cols => 40, :rows => 12 %></p> <% end %> This will submit to the ResolveController.create action, which is where you should create a resolve object/ -- Posted via http://www.ruby-forum.com/.
Oops, sorry, that text area in the amended form should be <%= f.text_area :content, :cols => 40, :rows => 12 %></p> -- Posted via http://www.ruby-forum.com/.
Max Williams wrote:> Oops, sorry, that text area in the amended form should be > > <%= f.text_area :content, :cols => 40, :rows => 12 %></p>thanks guys nw its working fine... -- Posted via http://www.ruby-forum.com/.
Ralu rm wrote:> Max Williams wrote: >> Oops, sorry, that text area in the amended form should be >> >> <%= f.text_area :content, :cols => 40, :rows => 12 %></p> > >but in dat form_for .... der is no action , will it directly go to :action => ''create''?? -- Posted via http://www.ruby-forum.com/.
dude, there''s an api for a reason!! I personally like the version at http://railsbrain.com, why not go and read it. -- Posted via http://www.ruby-forum.com/.
Max Williams wrote:> dude, there''s an api for a reason!! I personally like the version at > http://railsbrain.com, why not go and read itam just a beginner, dats y dat quest buddy... anyway thanks for the link! -- Posted via http://www.ruby-forum.com/.
Ralu rm wrote:> Max Williams wrote: >> dude, there''s an api for a reason!! I personally like the version at >> http://railsbrain.com, why not go and read it > > am just a beginner, > dats y dat quest buddy... > anyway thanks for the link!I know you''re a beginner, but if you know the name of the method that you have a question about, your first stop should always be the api. -- Posted via http://www.ruby-forum.com/.
Max Williams wrote:> Ralu rm wrote: >> Max Williams wrote: >>> dude, there''s an api for a reason!! I personally like the version at >>> http://railsbrain.com, why not go and read it >> >> am just a beginner, >> dats y dat quest buddy... >> anyway thanks for the link! > > I know you''re a beginner, but if you know the name of the method that > you have a question about, your first stop should always be the api.k ill add it to my habit......... thanks! -- Posted via http://www.ruby-forum.com/.