Ruby on Rails
Wednesday, June 4, 2014
On 6/4/14, 10:30 AM, Colin Law wrote:
You are 100% correct, but he was going to redirect to Dicts#new. I took that to mean that he would pass the data along and then, when present, invoke new as if it were create.On 4 June 2014 15:25, Jesse Knutsen <dracorna@gmail.com> wrote:Essentially you are calling two different actions right now (in your design) where the first leads to the second through a redirect. This redirect will actually redirect the user on the browser level, its not just a render. While you can do that, its not efficient.Actually I don't think you can, unless the http spec has changed, I believe that redirect to a POST action is not permitted by the spec, or at least was not in version 1.1. Colin
I'm envisioning something that he was envisioning something such as
SessionsController
...
create
...
redirect_to new_dict_path(new_dict: params[:new_dict]
DictController
...
new
if params[:new_dict]
create logic
else
new logic
This would get very convoluted and inelegant.
Hence why I feel a Class of login that will do both the login logic and the create Dict logic in one place
Its similar to http://railscasts.com/episodes/416-form-objects?view=asciicast
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment