Also, someone asked about sqlite clients, and my answer at the time
was that they aren't necessary. While somewhat true, it probably
wasn't that helpful. You can use "sqlite3" on the command line, or
use whatever database & client you like. For instance, if you'd
rather use mysql, just add the mysql gem to the Gemfile, change the
adapter in /config/database.yml, so the entry would look like:
development:
adapter: mysql
database: rails_development
username: my_username
password: my super secret password
Then, you'll need to run "bundle install" and "rake db:setup". Just
don't commit these changes.
> --
> You received this message because you are subscribed to the Google Groups
> "GrinnellPlans Development" group.
> To post to this group, send email to
> grinnellplan...@googlegroups.com.
> To unsubscribe from this group, send email to
> grinnellplans-deve...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/grinnellplans-development?hl=en.
>
Some ruby specific things that are worth noting:
Ruby lets you be super lazy, it may be confusing at first, but in the
end you'll think of it as "concise".
*For example If a ruby method doesn't have a "return" specified. If
you don't specify a "return" the value of the last statement evaluated
will be returned.
* "current_account.nil?" is the same as "current_account().nil?"
* "@foo ||= bar " means if @foo is nil, @foo=bar
* Every controller inherits from ApplicationController, so all of
ApplicationController's methods are available to controller classes.
* "new_account_session_path" is a method name automagically created
because of the last line of /cofig/routes.rb . If you want to see all
available routes for a project, you can "rake routes" on the command
line. For more on how routes work, check out the ActionDispatch and
ActionController chapter in the rails book.
So, to put that all together, what "before_filter :require_user" does
is set the values of @current_account_session and @current_account.
It will redirect the user to the log in page if they're not logged in.
If they are logged in , then rails will continue with whatever method
was originally called.
Here's the documentation for Autlogic -
https://github.com/binarylogic/authlogic . In general, it's a safe
bet that the documentation for a gem is on github.com. Also, I'd
highly recommend http://railscasts.com when you're getting started.
There's an autlogic railscast at
http://railscasts.com/episodes/160-authlogic .
I'm guessing you knew quite a bit of this already, but I figured I'd
spell it out for others too.
I am a little stumped by the 'before_filter :require_user' line in the
plans controller.
Google suggests this has something to do with the
authlogic gem we have in our bundle. Could someone please explain how
this gem works or point me to some documentation?
Also, how does RAILS
end up rendering the /app/view/account_sessions/new.haml?
Which files
are executed between the time of initial request for / and the login
page being rendered?
Thanks,
Shitanshu