Friday, December 17, 2010

rspec and object assignment

In rails console I can say

ob = JoinObject.new(:join_a => @a, :join_b => @b)

And all is well.
In rspec (I have: gem 'rspec-rails', '>=2.2.0' in my Gemfile) I need to use the _id to make it work

ob = JoinObject.new(:join_a_id => @a.id, :join_b_id => @b.id)

Any light to be shed?

the order of javascript_include_tag

I had this in my main layouts

= javascript_include_tag :defaults, "jquery", "jquery-ui", "json", "custom_helpers"

and everything was find in development environment. However in production things where wrong. rails.js was throwing an error about jquery not existing. So I changed it to this

= javascript_include_tag "jquery", "jquery-ui", "json", "custom_helpers"
= javascript_include_tag :defaults

And all was good again.