I have just started out learning rails and ruby, so please bear with me if this is too dumb.
There are several different AppModule types in my app, which have different behavior but similar data, so I save them using single table inheritance.
However when trying allow the user to explicitly select which type they want in app_modules/new.html.erb
I get the warning WARNING: Can't mass-assign these protected attributes: type
. Here is the relevant code:
<% form_for(@app_module) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :type %><br />
<%= f.select( :type, options_from_collection_for_select(AppModule.subclasses().map{ |c| c.name}, 'to_s', 'to_s')) %>
</p>
<%= f.submit 'Create' %>
<% end %>
I have tried explicity setting attr_accessible :type
in the model file but it didn't work
I am using rails 2.3.8 and ruby 1.8.7.
Any help greatly appreciated, thanks...