[Rails] Re: Date from user input

2011-04-25 Thread Tom Ricks
I must have made some mistake because I checked if request.post? Date.new(params[:year].to_i, params[:month].to_i, params[:day].to_i) end again and it does not call an error either. However anytime I input any numbers into the fields, i get the same invalid date error. Is there something wrong

[Rails] Re: Date from user input

2011-04-25 Thread Tom Ricks
Tim Shaffer wrote in post #994920: > The easiest way is probably just "if request.post?" > > Be careful though - it could be a post request without the parameters > you > are looking for. Might also be helpful to check if the params hash > contains > the keys you plan on using. > > Another option i

[Rails] Re: Date from user input

2011-04-25 Thread Tom Ricks
Tim Shaffer wrote in post #994906: > On Monday, April 25, 2011 12:00:43 PM UTC-4, Ruby-Forum.com User wrote: >> >> I find this odd because I haven't even inputted any variables in the >> view yet the date is invalid? >> > > Actually that's probably exactly why you have an invalid date. If you > hav

[Rails] Date from user input

2011-04-25 Thread Tom Ricks
Hello, I am trying to create a Date instance from user input, but I keep getting the ArgumentError invalid date. Here's the simplified version: View: <%= form_tag "/" do %> <%= number_field_tag(:month) %> <%= number_field_tag(:day) %> <%= number_field_tag(:year) %> <%= submit_tag "Date" %> <

[Rails] Re: How to change the url (from localhostL:3000) to (example.com)

2011-04-18 Thread Tom Ricks
I am very new to rails as well, but I am pretty sure that's not possible in development mode, and why would you want to do it, developing under local is much faster than having to update your server files every time. You would have to deploy it to change the url that its under, like get a serve

[Rails] Simple UJS Fields

2011-04-18 Thread Tom Ricks
Hello, I have the view: <% form_tag '/' do %> <%= number_field_tag(:number_one) %> <%= number_field_tag(:number_two) %> <%= submit_tag 'Calculate' %> <% end %> <%= @number %> and the controller: def add numberone = params[:number_one].to_f numbertwo = params[:number_two].to_f @numbe