This occurs when I try to run rails g bootstrap:themed Associations
in my terminal:
C:/Users/ruby/.pik/rubies/Ruby-193-p327/lib/ruby/gems/1.9.1/gems/twitter-bootstrap-rails-2.1.9/lib/generators/bootstrap/themed/themed_generator.rb:87:in `block in retrieve_columns': undefined method `columns' for Association:Class (NoMethodError)
It just can't seem to work, I've tried many ways, searched everywhere, never succesful. I'm using Mongo.
I just got exact same error. I created two identical project - one with mongoid and one without. I only get the error on the mongoid project.
Found this workaround that seems to solve the problem:
Remove references to ActiveRecord (around line 87) in the file:
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327/bundler/gems/twitter-bootstrap-rails-b8b7eb22614a/lib/generators/bootstrap/themed/themed_generator.rb
I changed ...
def retrieve_columns
if defined?(ActiveRecord)
rescue_block ActiveRecord::StatementInvalid do
@model_name.constantize.columns
end
else
rescue_block do
@model_name.constantize.fields.map {|c| c[1] }
end
end
end
to this ...
def retrieve_columns
rescue_block do
@model_name.constantize.fields.map {|c| c[1] }
end
end
To get the views working I needed to make sure that my model class had a created_at field that wasn't nil (alternatively edit the generated views).
Hope this helps.
PS: Wow ... it seems you've got twitter-bootstrap-rails working on windows - I didn't know that was possible!