> Your :new action in your controller probably needs a
>  "@hotel.build_facility"

Apologies for the new thread.

If i change to what you suggested, the same error apears, but for the
@facility

ActiveModel::MassAssignmentSecurity::Error in HotelsController#create

Can't mass-assign protected attributes: @facility
app/controllers/hotels_controller.rb:60:in `new'
app/controllers/hotels_controller.rb:60:in `create'


As for the code, I even tried to do this on the hotel_controller:

def create

    @hotel = Hotel.new(params[:hotel]).Facility.new(params[:facility])
    @hotel.save

  end

But with no success, still mass-assignement error

Display log:

Started POST "/hotels" for 127.0.0.1 at Mon Apr 16 13:57:18 +0100 2012
Processing by HotelsController#create as HTML
  Parameters: {"hotel"=>{"@facility"=>{"concierge"=>"0",
"room24h"=>"1"}, "rating"=>"2", "recommended"=>"0", "name"=>"kjo"},
"utf8"=>"✓", "commit"=>"Create Hotel",
"authenticity_token"=>"buHOvKyQup/ljrFcUej8mzZ01DEJGxYqaUMvUUkyjn8="}
Completed 500 Internal Server Error in 0ms

ActiveModel::MassAssignmentSecurity::Error (Can't mass-assign protected
attributes: @facility):
  app/controllers/hotels_controller.rb:60:in `new'
  app/controllers/hotels_controller.rb:60:in `create'


  Rendered
c:/Ruby187/lib/ruby/gems/1.8/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb
(1.0ms)
  Rendered
c:/Ruby187/lib/ruby/gems/1.8/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb
(2.0ms)
  Rendered
c:/Ruby187/lib/ruby/gems/1.8/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb
within rescues/layout (29.0ms)

I thank you for your time to help me.

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to