Markaby in HostingRails causes some TemplateError. To fix it, in vendor\plugins\markaby\lib\markaby\rails.rb, replace
compile_and_render_template(template_extension, template, file_path, local_assigns)
with
compile_and_render_template(@@template_handlers[template_extension.to_sym], template, file_path, local_assigns)
source: comments section of a posting in the RoR blog.
Thursday, January 3, 2008
Thursday, December 13, 2007
rSpec and Relationships
I spend a good 3 hours figuring out why my spec tests were failing. Let me explain my scenario to you.
My scenario was pretty much like this: Student belongs to Class.
My test: a student should know what class it belongs to.
My student_spec:
My scenario was pretty much like this: Student belongs to Class.
My test: a student should know what class it belongs to.
My student_spec:
it "should know what class it belongs to"Failed! Apparently, you cannot insert into the array "<<". You need to do it like this:
@student = Student.new
@class = Class.new(:name => "Math")
@class.students << @student
@student.class.name.should == "Math"
end
@student.class = @classWell, I'm not that stupid that it'd take me 3 hours to figure that out! My test was longer of course! I just made it simple for example's sake. :P
Monday, December 3, 2007
Rails on Dreamhost
Setting up Rails in Dreamhost is a bit tricky. Dreamhost has a wiki on how to do it but as of today, it doesn't work quite right.
I just installed on and it worked fine so here's how I did it:
1) If you haven't yet, create the user account through their control panel with FCGI enabled.
2) Log on to the user account that you created via shell.
3) type "rails yourappname"
4) type "rm useraccount.dreamhosters.com" since we'll replace it with a symbolic link.
5) type "ln -s yourappname/public/ useraccount.dreamhosters.com"
6) type "cd yourappname"
7) edit public/.htaccess (make sure what you edited isn't the commented line):
ENV['RAILS_ENV'] ||= 'production'
10) Your Rails app should be working fine now. You'll need to edit the database.yml and stuff to make sure that you can connect to the database of course.
Goodluck!
I just installed on and it worked fine so here's how I did it:
1) If you haven't yet, create the user account through their control panel with FCGI enabled.
2) Log on to the user account that you created via shell.
3) type "rails yourappname"
4) type "rm useraccount.dreamhosters.com" since we'll replace it with a symbolic link.
5) type "ln -s yourappname/public/ useraccount.dreamhosters.com"
6) type "cd yourappname"
7) edit public/.htaccess (make sure what you edited isn't the commented line):
8) AfterRewriteRule ^(.*)$ dispatch.cgi [QSA,L] toRewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
require 'fcgi_handler', change the rest of dispatch.fcgi to read: class RailsFCGIHandler9) edit your config/environment.rb and uncomment the line:
private
def frao_handler(signal)
dispatcher_log :info, "asked to terminate immediately"
dispatcher_log :info, "frao handler working its magic!"
restart_handler(signal)
end
alias_method :exit_now_handler, :frao_handler
end
RailsFCGIHandler.process!
ENV['RAILS_ENV'] ||= 'production'
10) Your Rails app should be working fine now. You'll need to edit the database.yml and stuff to make sure that you can connect to the database of course.
Goodluck!
Friday, November 16, 2007
Onto Rails and rSpec
Like I mentioned yesterday, I started trying out rSpec. When in Rails, it's a little different. You need to include more stuff. I couldn't get my spec to run properly. Apparently, you have to import a bunch of stuff:
require File.dirname(__FILE__) + '/../../config/boot'
require "#{RAILS_ROOT}/config/environment"
require File.dirname(__FILE__) + '/../../app/models/project_management'
The first two lines I got from the codehappy blog post. The third just imports the model I'm testing out.
I may be doing it completely wrong so I'd appreciate any feed back.
require File.dirname(__FILE__) + '/../../config/boot'
require "#{RAILS_ROOT}/config/environment"
require File.dirname(__FILE__) + '/../../app/models/project_management'
The first two lines I got from the codehappy blog post. The third just imports the model I'm testing out.
I may be doing it completely wrong so I'd appreciate any feed back.
Thursday, November 15, 2007
Command line Subversion, Rails
Like I mentioned on my earlier post, I'm a slow learner when I read manuals. I like watching much more. Check out episode 36 on Railscasts. It gives a nice quick overview on how it's done on the Mac. It's the same on Linux.
Learning Behaviour Driven Development
I've been doing a bunch of Google searches on Behaviour Driven Development (BDD) but all I've found were long articles and wordy introductions. I suppose some people learn that way but I'm way to lazy.
Thank goodness for screencasts. To dive into it, check out the website smartic.us' screencasts on rSpec.
Obviously, I don't know much. All I know is that rSpec is a gem used for testing. He dives straight into making a class and testing it. Or rather, testing it, then making the class. You'll see. :)
Thank goodness for screencasts. To dive into it, check out the website smartic.us' screencasts on rSpec.
Obviously, I don't know much. All I know is that rSpec is a gem used for testing. He dives straight into making a class and testing it. Or rather, testing it, then making the class. You'll see. :)
Saturday, November 10, 2007
Ubuntu and gVim
I've always been a Windows or DOS user ever since childhood. In the past several years I have tried to migrate to Linux.
Here comes in Ruby on Rails... on gVim... on... Ubuntu. It's nice and fast. you feel like you put your computer on steroids. Enough talk. Let me share with you the simple steps I took to install it.
Here comes in Ruby on Rails... on gVim... on... Ubuntu. It's nice and fast. you feel like you put your computer on steroids. Enough talk. Let me share with you the simple steps I took to install it.
- Install Ruby on Rails so that gVim may be able to access whatever files are in the RoR install.
- Go to http://www.cs.cornell.edu/w8/~djm/ubuntu/gutsy/#gvim and follow the installation instructions for gVim.
- Go back to my earlier post on Vim and you may follow that and paste the custom files in the gVim ~/.vim/ (which is equivalent to the Window's ~/vimfiles/ folder).
Subscribe to:
Posts (Atom)