As you can see, My blog just have RSS feed. @wiennat asked me that why I don't have RSS. So I did it . It's very simple and easy to create RSS feed. But if you google it using keyword "rss", you will get many unrelated results. Also, I used Rails 2.3.2 and many examples used lower version and it didn't work with 2.3.2. For you guys who use will_paginate, creating only .rss.builder file is not enough because it will show only posts in that page. You can define new method in the controller and map the route to it. Example
"articles_controller.rb" def feed
@articles=Article.find(:all)
end
Remember that the order of map.connect is important. The top most has higest priority. So, you have to put this line before "map.connect ':controller/:action/:id". Good luck with RSS.
About my iphone, today I cannot use internet from my iphone. I searched and found that it might because my old iphone setting. I disable GPRS in my old one and when I sync it with the new one it still disable. It's very easy to fix this problem just reset it.
A tool that I use for testing my web is Cucumber. Cucumber is a tool for Behavior Driven Development (BDD). I think it's really cool because it's easy to use and easy to understand. Scenarios in Cucumber will be written like speaking language not programming language. This helps non-technical people such as designers and business owners understand the scenario better. I will show you an example of Cucumber.
First, you write the scenario
Define steps, tell Cucumber what you want it to do.
Run "cucumber features"
Yea it's Done!
If you install Cucumber and webrat and got errors like " iconv is missing. try 'port install iconv' or 'yum install iconv' "
or " libxslt is missing. try 'port install libxslt' or 'yum install libxslt-devel' "
You have to install libxml2-dev and libxslt1-dev using
"sudo apt-get install libxml2-dev libxslt1-dev"
I'm working on my new project and it has many-to-many association. Also, I want to store additional fields in the relation. So, I used has_many :through in my models.
Example:
GIVEN: I have 2 models which are driver and bus. Driver can drive more than one bus and has start time and stop time for each bus. Also, bus can be drived by many drivers. ( Driver will drive particular bus only one period)
I will generate one more model called " Shift " which has bus_id, driver_id, start_time and stop_time.
Model:
class Shift < ActiveRecord::Base belongs_to :bus belongs_to :driver end class Driver < ActiveRecord::Base has_many :shifts has_many :buses, :through => :shifts end class Bus < ActiveRecord::Base has_many :shifts has_many :drivers, :through => :shifts end
Then, how to access start and stop time?
We treat Shiftas one model, so we can use s = Shift.find_by_bus_id_and_driver_id(busID,driverID)
to get the shift and s.start_time or s.stop_time to access the additional fields.