I’m new with ROR and am confused about passing parameters to functions.
I have a controller called Schedules and that calles a calendar helper
for a view called show_cal.rhtml. I need to be able to pass in a
specified month and year to get the correct schedule calendar to display
in the view. I’m just starting with this and am simply trying to
display the parameters I’m trying to pass in. Here’s what I’ve got so
class SchedulesController < ApplicationController
render :action => ‘show_cal’
#…other functions not listed
def show_cal(yr, mo)
set up dates based on yr, and mo
Calendar<%= yr %> <%= mo %>
<%= link_to ‘previous month’, :url =>
<%= yr %>
<%= mo %>
<%= link_to ‘previous month’, :url => ‘/schedules/show_cal?yr=2006&mo=5’
I know that this doesn’t work, but I’m trying to figure out how to get
mo and yr to display, and how to pass them into the show_cal function
from my link_to.
I hope this makes sense.