I want to do store the parameters from a form in a model. Since I don't want the model to use any database, it does not inherit from ActiveRecord::Base. I'm thinking it should look something like this:
# in view:
<% form_for :question, :url => {:action => "ask"} do |f| %>
<%= f.text_field(:q) %>
<%= submit_tag %>
<% end %>
# in controller:
def ask
# I want this to magically set all variables in @question using
# values from params.
@question = params[:question]
end
# in model:
class Question
attr_accessor :q
def initialize
@q = ""
end
end
But after spending 1½ days on it, it doesn't seem to be the right way to do it. Any suggestions would be much appreciated.