On 6/4/14, 10:08 AM, Ronald Fischer wrote:
> Jesse Knutsen wrote in post #1148805:
>> I am not a huge fan of an approach that would need to redirect in this
>> way.
>>
>> Instead, why not create a new class called login or something like that.
>>
>> You will need to adapt a bit to your needs, but the basics are sound and
>> should apply nicely.
> I don't think this would really solve the problem:
>
> From the model, user and login data are already separated from the Dicts
> data (the user id is a foreign key in the Dicts mode, pointing to the
> user who owns the Dict).
>
> In the controller side, I have them also separated: The HomeController
> is responsible for the Login (I could also have named it
> LoginController), and the DictController is responsible for managing the
> Dict objects. I don't see wll how what can be improved in this area.
>
> The problem is the user interface. Clicking one button performs a login
> AND at the same time either CREATES or OPENS a dict object.
> If I would split this into two views, one for login and one for the
> usual interface of maintaining dictionaries, I wouldn't run into this
> problem, but this would be less convenient to the user.
This solution is not splitting the actions up, Its replacing them with
super action that will validate and invoke the business logic of both.
At the same time you would have a single controller and view.
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.
This method would conglomerate the two into 1: A login.
If valid (valid being defined as a valid set of user credentials and
valid entries for the new Dicts) it would trigger a session creation and
the appropriate Dict creation, based on the button that is clicked.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/538F2C5F.9030105%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment