I'm creating my first Rails 3.2 application after completing the excellent Rails Tutorial.
I would like my application to do this:
Pull a random recipe from the database (I have finished this bit using the 'index' action and this bit of code: @recipe = Recipe.find(:first, :order => 'Random()'))
If the user clicks the 'something similar' button, the app fetches a related recipe from the db
If the user clicks 'something different', the app fetches an unrelated recipe
From what I understand, there should be an action for both 'something similar' and 'something different'. Is this correct?
Should I use a POST form with submit buttons for 'something different' and 'something similar' to determine which action to take?
Also, how can I keep the user on a single page throughout (so they always see the URL as http://www.whatshouldicookfordinner.co.uk rather than /recipes#somethingdifferent)?