Yes, adding
:creator => true
fixed it. For some reason I had set up all my other
models with :creator => true, except this one.
One last thing:
I reread the manual on <input> and was surprised to
learn that
<input:something>
and the type of 'something' is picked up from the model
and the appropriate field, in my case a <textarea> is
created: Cool!
jet
<textarea:contact_About param="about" />
On Jul 20, 12:37 pm, Matt Jones <[email protected]> wrote:
> Take a look at what your form is posting in the logs - I'm guessing
> you'll see :user_id => 'current_user.id' in there. Attributes that are
> code need to either have a & or be in #{} brackets.
>
> So either
>
> <input id="architect_agent_comment[user_id]"
> name="architect_agent_comment[user_id]" value="¤t_user.id"
> type="hidden" />
>
> or
>
> <input id="architect_agent_comment[user_id]"
> name="architect_agent_comment[user_id]" value="#{current_user.id}"
> type="hidden" />
>
> Also, you should be able to skip this entirely if you set :creator =>
> true on the user association (assuming that's the intent).
>
> --Matt Jones
>
> On Jul 20, 2009, at 3:33 PM, blueHandTalking wrote:
>
>
>
> > Also, the following:
>
> > <input id="architect_agent_comment[user_id]"
> > name="architect_agent_comment[user_id]" value="current_user.id"
> > type="hidden" />
>
> > now posts after being changed, but the user_id is 0, when it should be
> > 10.
>
> > Any ideas on that one?
>
> > I had thought that when I had the
>
> > belongs_to :user, :class_name => "User"
>
> > Hobo would infer this is a foreign key.
> > Do I need to manually assign user_id the way I am doing with the
> > hidden inpu?
>
> > jet
>
> > On Jul 20, 12:25 pm, blueHandTalking <[email protected]> wrote:
> >> Hi Matt,
>
> >> yes, that was my error! Thanks.
>
> >> the Hobo way,
>
> >> <textarea:contact_About param="about" />
>
> >> is still not working. Do I need to manually enter id and name with
> >> the
> >> hobo
> >> method?
>
> >> jet
>
> >> On Jul 20, 10:54 am, Matt Jones <[email protected]> wrote:
>
> >>> On Jul 19, 2009, at 6:43 PM, blueHandTalking wrote:
>
> >>>> This may not even be a hobo issue, but my first form effort is
> >>>> posting
> >>>> to db,
>
> >>>> but with null field content.
>
> >>>> I am assuming my model is O.K., since it is posting, except perhaps
> >>>> the following line:
>
> >>>> belongs_to :user, :class_name => "User"
>
> >>>> I have noticed in other places instead of :user, :owner was
> >>>> used. Not
> >>>> sure if that is preference or
> >>>> necessity---is :owner a built in symbol?
>
> >>>> This is the <form> that is posting but with null values. I used
> >>>> both
> >>>> the Hobo rapid method
> >>>> and normal way for textarea, both seemed to come up O.K.
>
> >>>> Here it is preceded with the set-up call:
>
> >>>> <% o=ArchitectAgentComment.new(params[:architect_agent_comment]) %>
> >>>> <padconnectform with="&o" />
>
> >>>> <def tag="padconnectform" for="ArchitectAgentComment">
>
> >>>> <div id="padcomment">
>
> >>>> <form merge param="default"
> >>>> update
> >>>> ="architect_agent_comments"success="Event.onReady(function() {$
> >>>> ('padcomment').style.visibility='hidden';$
> >>>> ('padconnect_confirm').style.visibility='visible';});">
>
> >>>> <error-messages param/>
> >>>> <input id="architect_agent_comments[user_id]"
> >>>> name="architect_agent_comments[user_id]" value="current_user.id"
> >>>> type="hidden" />
>
> >>>> <textarea id="architect_agent_comments[comment]"
> >>>> name="architect_agent_comments[comment]" param="ideas" /><br /
> >>>> ><br />
>
> >>> Are these posting to the right place? The generated form elements
> >>> will
> >>> typically have a singular name, not plural...
>
> >>> --Matt Jones
On Jul 20, 12:37 pm, Matt Jones <[email protected]> wrote:
> Take a look at what your form is posting in the logs - I'm guessing
> you'll see :user_id => 'current_user.id' in there. Attributes that are
> code need to either have a & or be in #{} brackets.
>
> So either
>
> <input id="architect_agent_comment[user_id]"
> name="architect_agent_comment[user_id]" value="¤t_user.id"
> type="hidden" />
>
> or
>
> <input id="architect_agent_comment[user_id]"
> name="architect_agent_comment[user_id]" value="#{current_user.id}"
> type="hidden" />
>
> Also, you should be able to skip this entirely if you set :creator =>
> true on the user association (assuming that's the intent).
>
> --Matt Jones
>
> On Jul 20, 2009, at 3:33 PM, blueHandTalking wrote:
>
>
>
> > Also, the following:
>
> > <input id="architect_agent_comment[user_id]"
> > name="architect_agent_comment[user_id]" value="current_user.id"
> > type="hidden" />
>
> > now posts after being changed, but the user_id is 0, when it should be
> > 10.
>
> > Any ideas on that one?
>
> > I had thought that when I had the
>
> > belongs_to :user, :class_name => "User"
>
> > Hobo would infer this is a foreign key.
> > Do I need to manually assign user_id the way I am doing with the
> > hidden inpu?
>
> > jet
>
> > On Jul 20, 12:25 pm, blueHandTalking <[email protected]> wrote:
> >> Hi Matt,
>
> >> yes, that was my error! Thanks.
>
> >> the Hobo way,
>
> >> <textarea:contact_About param="about" />
>
> >> is still not working. Do I need to manually enter id and name with
> >> the
> >> hobo
> >> method?
>
> >> jet
>
> >> On Jul 20, 10:54 am, Matt Jones <[email protected]> wrote:
>
> >>> On Jul 19, 2009, at 6:43 PM, blueHandTalking wrote:
>
> >>>> This may not even be a hobo issue, but my first form effort is
> >>>> posting
> >>>> to db,
>
> >>>> but with null field content.
>
> >>>> I am assuming my model is O.K., since it is posting, except perhaps
> >>>> the following line:
>
> >>>> belongs_to :user, :class_name => "User"
>
> >>>> I have noticed in other places instead of :user, :owner was
> >>>> used. Not
> >>>> sure if that is preference or
> >>>> necessity---is :owner a built in symbol?
>
> >>>> This is the <form> that is posting but with null values. I used
> >>>> both
> >>>> the Hobo rapid method
> >>>> and normal way for textarea, both seemed to come up O.K.
>
> >>>> Here it is preceded with the set-up call:
>
> >>>> <% o=ArchitectAgentComment.new(params[:architect_agent_comment]) %>
> >>>> <padconnectform with="&o" />
>
> >>>> <def tag="padconnectform" for="ArchitectAgentComment">
>
> >>>> <div id="padcomment">
>
> >>>> <form merge param="default"
> >>>> update
> >>>> ="architect_agent_comments"success="Event.onReady(function() {$
> >>>> ('padcomment').style.visibility='hidden';$
> >>>> ('padconnect_confirm').style.visibility='visible';});">
>
> >>>> <error-messages param/>
> >>>> <input id="architect_agent_comments[user_id]"
> >>>> name="architect_agent_comments[user_id]" value="current_user.id"
> >>>> type="hidden" />
>
> >>>> <textarea id="architect_agent_comments[comment]"
> >>>> name="architect_agent_comments[comment]" param="ideas" /><br /
> >>>> ><br />
>
> >>> Are these posting to the right place? The generated form elements
> >>> will
> >>> typically have a singular name, not plural...
>
> >>> --Matt Jones
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---