ruby on rails - Displaying all Articles Created by a User Devise -


using devise on rails 4 app.

i users able view articles they've created, inside of devise edit registration page.

i have tried lots of different things in order work, cannot. awesome. here code far:

registrations_controller.rb (had manually create inside of controllers/users):

class users::registrationscontroller < devise::registrationscontroller   def articles     @user = user.find(params[:id])     @articles = @user.articles   end end 

routes.rb:

devise_for :users, controllers: { registrations: "users/registrations" } 

user.rb:

has_many :articles 

article.rb:

belongs_to :user 

edit.html.erb (inside of views/devise/registrations):

<% @articles.each |article| %>   <%= article.inspect %> <% end %> 

still new rails on might doing wrong and/or best way go great. let me know if need other of code.

i think forgot add ) @ last. see this,

@user = user.find(params[:id]) 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -