views:

38

answers:

1

Complete rails novice and something just isn't clicking.

On my home page /home - I use devise, so I have a check .

<% if user_signed_in? %>

<%= render "getting_started" %> 

<% else %>

Welcome!
<%= link_to "Sign up", new_user_registration_path%>

<% end %>

At the moment getting_started.html.erb has some instructions and then I'm displaying /users/_getting_started_form.html.erb.

The form is there with some extra fields already catered for in the model (eg. username, which I'd like users to set once they've logged in with email/password, rendered with <%= form_for(@user) do |f| %>

.. and it renders without error once I put:

@user = :current_user

..into the home method of PagesController. But that's not right is it? I'd want to be posting to the users controller. I want the getting started form to take the data entered, post it to the users controller, and save the data to the model.

Sorry for the confusion, things just aren't making sense with the amount of things rails automates - part of the issue for me is in PHP I'd just post a form to the appropriate controller myself, and also devise - which I plunged in to get user authentication done properly quickly doesn't create a users controller for me, which I find that very confusing that sign up, etc. works without a file named UsersController being there. I'm (clearly) very confused on this and best approaches in rails. - Help very much appreciated.

A: 

Why :current_user? That's a symbol and doesn't point to any User object. Perhaps what you're after is simply current_user?

Ryan Bigg