rubyonrailsin

A Ruby and Rails talk

Wednesday, March 17, 2010


Re: [Rails] How do I determine the "source" action for conditionally rendering error actions and validation messages?

by rubyonrailsin 0 comments

Tag


Share this post:
Design Float
StumbleUpon
Reddit

On 17 March 2010 16:06, Colin Law <clanlaw@googlemail.com> wrote:
>> The RESTful way is to have a "dispense_stock" controller - which has
>> its own methods.
>>
>> The cheaty (smelly) way is to put a hidden field in the form or an
>> extra querystring parameter with with the value "new" or "dispense",
>> and check the params hash for the value.
>
> Whether this is smelly or not really depends on how similar the two
> actions are.

Don't get me wrong - I wasn't saying *don't* use a hidden param - I
was suggesting it as a perfectly acceptable option... it's just that I
know the REST police will jump on you if you're not careful.
To be honest, in lots of situations, the quick, easy (dirty?) way is
best *because* it's quick and easy.

And you're right; it may be perfectly possible to design the form to
use the same, restful action, and please everybody :-)

--
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@googlegroups.com.
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.

No comments:

Post a Comment

Subscribe feeds via e-mail

Blog Archive