Accessing the params hash for year and month rails and using in helper
- by Matt
So I took some php code and turned it into a calendar with a helper to make a simple calendar.
I got my data from inside the helper:
def calendar_maker
a = Time.now
b = a.month
d = a.year
h = Time.gm(d,b,1) #first day of month
Now I want to try and do it with parameters within my method
#from the helper file
def calendar_maker(year, month)
a = Time.now
b = month
c = year
h = Time.gm(d,b,1) #first day of month
#from my html.erb file
<%= @month %> and <%= @year %>
<%= params["month"] %><br />
<%= params["action"] %><br />
<%= params["year"] %><br />
<%= calendar_maker( @year, @month) %>
#from controller file
def calendar
@month = params[:month]
@year = params[:year]
end
Anyways mistakes were made and not finding documentation anywhere or not looking in the right place. How do I get this to work with my params hash. Thanks for the help.