Hello all. I''ve got a model that basically records whever a user has completed an action. When it''s created it auto fills in the user_id via sessions etc. However I want to create links on the various actions, so users can just click them, eg navigating possible actions with a button for "complete!" and that will insert a value into the model for them. <%= button_to "Complete!",user_actions_path,:action_id => action.id, :method => :post %> This posts the page correctly, however it complains that the action/ action_id is null (as i''m using validations in the model to stop this. I''ve tried tweaking action_id to action and removing action.id etc. But nothing works. Action id is a proper id too, but by the time rails gets to it it''s null... I have no idea how to fix this too?. Anyone got any clues? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Fri, Aug 5, 2011 at 3:33 AM, Beau <beautrepp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> <%= button_to "Complete!",user_actions_path,:action_id => > action.id, :method => :post %> > > This posts the page correctly, however it complains that the action/ > action_id is null> I have no idea how to fix this too?. Anyone got any clues?1) Use `View Source` to inspect the rendered HTML to see what values are set there. 2) Look at your Rails log to see exactly what''s being submitted. If that doesn''t show you the problem, post the relevant parts of both those here. -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://about.me/hassanschroeder twitter: @hassan -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Beau wrote in post #1015128:> <%= button_to "Complete!",user_actions_path,:action_id => > action.id, :method => :post %>This might seem trivial and persnickety, but please don''t use punctuation in buttons, toolbar items or menus. The word "Complete" is not a sentence and doesn''t deserve punctuation. The one exception to this rule is the use of the ellipsis to indicate that choosing the button or menu item will request further input from the user (e.g. a dialog/input box). "Open Recent..." for example. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
:) It doesn''t actually say that. I figured it was easier to change the text to represent an easier concept than the actual app. I did discover that i need to pass the arguments in this way though. Rather than specifying :action_id=> id as a parameter, I needed to add it to the link. Eg user_actions_path(:action_id=>id), :method=>:post This of course still didn''t enter it in correctly, but I could read :action_id out in the controller. Looking at the controller code it was reading the param :action out. So the way to call this is. user_actions_path(:action=>{:action_id => id}) So now I can post all the data by working it out from the page. I''m surprised the information to do this was so hard. On Sat, Aug 6, 2011 at 3:10 AM, Robert Walker <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Beau wrote in post #1015128: > > <%= button_to "Complete!",user_actions_path,:action_id => > > action.id, :method => :post %> > > This might seem trivial and persnickety, but please don''t use > punctuation in buttons, toolbar items or menus. The word "Complete" is > not a sentence and doesn''t deserve punctuation. The one exception to > this rule is the use of the ellipsis to indicate that choosing the > button or menu item will request further input from the user (e.g. a > dialog/input box). "Open Recent..." for example. > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.