A few basic questions
1. How do you use the link_to method to call an action and pass it parameters so the url looks like
I know how to make it look like
when I do this <%=link_to "next", :action=> "month_view/2008/02" %>
it just escapes the forward slashes so the url looks like
2. Is it possible to develop a ROR app without have a db to connect to ... If I try to run a rails app and haven't created a mysql db, it gives me an error message and will not load the app.
Add a route to your routes.rb to do that. It will look like this:
Just tweak it to the actual controller and action you are using, and remember to add this before the default routes, because they are evaluated in the order they appear in the file.
:controller => 'application',
:action => 'monthly_view'
EDIT: Oh yes, and then you can create the link simply using :year and :month as named parameters:
<%= link_to "next", :action=> "month_view", :year => "2008", :month => "02" %>
See ... I tried that and the url becomes something like
Originally Posted by ruby-lang
I want it to be
What is your routes.rb like after you added that route? What version of rails are you using?
Thanks a million ruby-lang ... changing the routes worked perfectly!
The wiki is down right now, but when it is up you can see how to use Rails without ActiveRecord attempting to establish a database connection:
Originally Posted by ikeo
It comes down to adding/uncommenting this line in your config/environment.rb file:
config.frameworks -= [ :active_record ]
This will prevent ActiveRecord from being loaded at all.
okay ... I'm going to try this.