2 questions: redirect and form fields

Just three quick questions: 1) when a user logs in, how do you redirect her to the last page they were on? 2) what do most use for a form field that lists all the states in a certain country? 3) when you create a form, the default size for the form is "size" => 30. Now I know I can change that number but what if I wanted to leave it out and control the width of my fields in css? also, how do I add a class="" to the form field (for css styling)?

Thanks, Elle

1) you can store the last request they made in the session, then upon successful login, use redirect_to to redirect them there 2) I don't so I will defer to others 3) <%= text_field :obj, :method, :class => 'foo', :style => 'font-weight: bold;'-%> #etc, etc

You should check out the full documentation at http://api.rubyonrails.org.

-Bill

elle wrote:

Thanks Bill.

I've tried a plugin called state_select and it worked good as long as I wanted states from one country only. The plugin can't display states from both US and Canada. So, I've added the following method to the application.rb:

def state_dropdown     states = ["Alabama", "Alaska", "Alberta", "Arizona", "Arkansas", "British Columbia", "California", "Colorado", "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Manitoba", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Brunswick", "New Hampshire", "New Jersey", "New Mexico", "New York", "Newfoundland", "North Carolina", "North Dakota", "Northwest Territories", "Nova Scotia", "Nunavut", "Ohio", "Oklahoma", "Ontario", "Oregon", "Pennsylvania", "Prince Edward Island", "Puerto Rico", "Quebec", "Rhode Island", "Saskatchewan", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "Washington D.C.", "West Virginia", "Wisconsin", "Wyoming", "Yukon"]     states.each do | s |      <option value="#{s}"> s </option>     end   end

And I wanted to ask: 1) Is this the right place to add this method? 2) Would the above work?

Thanks, Elle

So, I've added the following method to the application.rb:

Actually meant application_helper.rb

Elle