Saturday, 14 September 2013

Ruby on Rails: form_for is not showing content inside

Ruby on Rails: form_for is not showing content inside

I'm trying to create a form so I can update user's content information,
but my form is not showing up.
My form in views/admin/dashboard/index.html.erb:
<% form_for @admin do |f| %>
... form content...
<% end %>
this is my controller in controllers/admin/dashboard_controller.rb
class Admin::DashboardController < ApplicationController
def index
@users = User.all
@admin = User.new
end
end
this is my model: models/admin.rb
class Admin < ActiveRecord::Base
belongs_to :user
end
Then in my users model: models/user.rb
class User < ActiveRecord::Base
has_many :admins
end

No comments:

Post a Comment