Show a partial and index in another directory
Hi everyone at this time I have two scaffolds
users userscuentas
Then I want to show in the file app/views/users/_layout_form.html.erb the
file app/views/userscuentas/index.html.erb and also the file
app/views/userscuentas/new.html.erb
At the moment I have it this way in the file
app/views/users/_layout_form.html.erb
<div class="tab-pane" id="tab4">
<p>
<%= render :file => "/userscuentas/index.html.erb" %>
</p>
</div>
The index file is in default when normally we generate the scaffold
then this way are the models
app/models/user.rb
has_many :userscuentas, :dependent => :destroy
app/models/userscuentas.rb
belongs_to :user
and finally In the routes.rb is this way
resources :users do
resources :userscuentas
end
But i got this error ` NoMethodError at /users/1/edit
undefined method each' for nil:NilClass
So I dont know what to do
Thanks For your help
No comments:
Post a Comment