I apologize for the embarrassingly simplistic nature of this question,
but I'm new to Ruby/Rails.
From within a html.erb file, what is the syntax for assigning a value
to a parameter? For example, when a specific form is used, the
following attribute (make_this_true) should always be 1
but I don't have to tell the readers of this group that the above code
is garbage.
1. is there an easy way to set this attribute? If so, what is the
syntax?
2. My first attempt at solving this problem involved using a check box
or a radio button that defaulted to "true" but this turned out to be
non-intuitive as well. I then realized that the user should not need
to interact with this variable here.
3. Perhaps making the default value of this variable true in the
database schema? Any tips on that route?
Sorry for the long-windedness and simplistic nature of this question.
Having a default in the DB schema is likely a good idea,too. If this is actually a boolean, having :default=>true,:null=>false keeps you from dealing with NULL values in the database.
I apologize for the embarrassingly simplistic nature of this question,
but I'm new to Ruby/Rails.
From within a html.erb file, what is the syntax for assigning a value
to a parameter? For example, when a specific form is used, the
following attribute (make_this_true) should always be 1
but I don't have to tell the readers of this group that the above code
is garbage.
1. is there an easy way to set this attribute? If so, what is the
syntax?
2. My first attempt at solving this problem involved using a check box
or a radio button that defaulted to "true" but this turned out to be
non-intuitive as well. I then realized that the user should not need
to interact with this variable here.
3. Perhaps making the default value of this variable true in the
database schema? Any tips on that route?
I'd do it with a hidden field, others may be able to recommend something else though.