I''m Trying to store the requesttpeid which is coming form the
requesttypes
table and I''m trying to stroe that ID in Requests table as
requesttypetid.
Here''s what I''m trying,
in the controller :
def new
@
end
def edit
@requesttypes = Requesttype.find_all
@emprequest = Emprequest.new
@emprequest.requesttypeid = params[:reqtype]
@emprequest.save
end
In the view (_form.rhtml)
<select name="reqtype">
<% @requesttypes.each do |requesttype| %>
<option value="<%= requesttype.id %>" >
<%= requesttype.requesttypename %>
</option>
<% end %>
</select>
The problem is that i''m unable to store this id in the table and it is
displaying an error like nil.object
But this is working fine when I tried this with out using ajax.
Can you please help me to over come this problem,
On 11/30/06, Phlip <phlip2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
>
> Manoj Pandey wrote:
>
> > I''m trying to generate a random number which acts as the ID
for Request
> > table in the Release Planning Project,
> >
> > I''m able to generate the random number successfully but
I''m unable to
> set
> > this random number as the ID value
> > for the table using ajax on RoR .
>
> Post some code.
>
> You don''t seem to have an AJAX problem. If the ID appears in a
model or
> controller, then you write the ID into the file using common RHTML stuff
> like <%= id %>
>
> If the ID then comes back, it should go as a <input
type=''hidden'' ... />
> field. AJAX might route its parent <form> back; is that what you
need?
>
> --
> Phlip
> http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---