Params question

I'm a little embarrassed to ask this but I have a url that is like:


and in foo_controller I'm trying to access it like so:

def bar     @start_time = get_start_time(params) end

def get_start_time(params)     if params['start'].to_s != nil       return '?start='+params['start'].to_s     end   end

I'm coming from PHP/.NET so RESTfulness is a little difficult for me to wrap my head around. Maybe I'm googling on the wrong terms but I haven't had any luck yet...Any advice would be very appreciated.

I'm not sure what exactly your trying to do with the get_start_time method when it looks like you just want:

@start_time = params[:start]

Here is a good REST pdf.

Hi thanks for the respone. I just need to have @start_time = "? start="+params[:start] only if params[:start] isn't empty, i.e. if the url isn't


but is


That works perfectly, thank you so much. I'm curious how ruby, like, well anything else I work with, doesn't require a return statement:

  def get_start_time(params)     if params['start']       return "?start=#{params['start']}"     end   end

The value returned by a Ruby method is the value of the last
expression evaluated.


Best, Thomas