Undefined method `stringify_keys!' for "":String

i have an error
undefined method `stringify_keys!’ for “”:String

my view is given below

<%= form_tag :action => ‘resolve_create’, :resolve => @resolve %>

resolution:
<%= text_area 'resolve','content', :cols => 40, :rows => 12 %>

<%= submit_tag “save” %>

what is dat error and how can i solve them?
can any one help me…

thanks

hi

Give me ur controller code.

thanks
seenu

On Thu, Oct 22, 2009 at 1:54 PM, Ralu rm

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…

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

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 <

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 S.

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!

Brijesh S. 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 S.

no 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?

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 ?

Sijo

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 ?

Sijo

then how can i pass the value resolve which iam getting from the user ?

is dat iam going in a rubbish way…???

<%= form_tag :action => ‘resolve_create’, :resolve => @resolve %>

resolution:
<%= text_area 'resolve','content', :cols => 40, :rows => 12 %>

<%= submit_tag “save” %>

Try below code

<%= form_tag :action => ‘resolve_create’ do %>

resolution:
<%= text_area 'resolve','content', :cols => 40, :rows => 12 %>

<%= submit_tag "save" %> <%end>

Hi Ralu rm

That is already there in params[:resolve]

Sijo

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| %>

resolution:
<%= f.text_area 'resolve','content', :cols => 40, :rows => 12 %>

<% end %>

This will submit to the ResolveController.create action, which is where
you should create a resolve object/

Oops, sorry, that text area in the amended form should be

<%= f.text_area :content, :cols => 40, :rows => 12 %>

Max W. wrote:

Oops, sorry, that text area in the amended form should be

<%= f.text_area :content, :cols => 40, :rows => 12 %>

thanks guys
nw its working fine…

dude, there’s an api for a reason!! I personally like the version at
http://railsbrain.com, why not go and read it.

Max W. 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!

Ralu rm wrote:

Max W. 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.

Ralu rm wrote:

Max W. wrote:

Oops, sorry, that text area in the amended form should be

<%= f.text_area :content, :cols => 40, :rows => 12 %>

but in dat form_for … der is no action ,
will it directly go to :action => ‘create’??

Max W. wrote:

Ralu rm wrote:

Max W. 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!