seyhunak / twitter-bootstrap-rails

Twitter Bootstrap for Rails 6.0, Rails 5 - Rails 4.x Asset Pipeline
https://github.com/seyhunak/twitter-bootstrap-rails
4.49k stars 997 forks source link

Does not play nice with mongoid #600

Closed michaelirey closed 10 years ago

michaelirey commented 11 years ago

I love twitter-bootstrap-rails and I love mongoid. However, right now they do not love each other...

Here are the steps to recreate starting from brand new rails app:

rails new funky --skip-active-record
cd funky
echo 'gem "mongoid", "~> 3.0.0"' >> ./Gemfile
echo 'gem "therubyracer"' >> ./Gemfile
echo 'gem "less-rails"' >> ./Gemfile
echo "gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'" >> ./Gemfile

bundle install
rails generate mongoid:config
rails generate bootstrap:install static
rails generate bootstrap:layout application fluid --force
rails g scaffold Post title:string description:text
rails g bootstrap:themed Posts --force
rails server

Notice the extra fields?

1-index

This seems awkward now...

2-new-post

But lets add some data...

3-adding-post

Now things seem mis-aligned

4-created

And now the stack trace

5-index-after-create

Here is a list of all the gem versions I am using:

Using rake (10.0.4) 
Using i18n (0.6.1) 
Using multi_json (1.7.7) 
Using activesupport (3.2.13) 
Using builder (3.0.4) 
Using activemodel (3.2.13) 
Using erubis (2.7.0) 
Using journey (1.0.4) 
Using rack (1.4.5) 
Using rack-cache (1.2) 
Using rack-test (0.6.2) 
Using hike (1.2.3) 
Using tilt (1.4.1) 
Using sprockets (2.2.2) 
Using actionpack (3.2.13) 
Using mime-types (1.23) 
Using polyglot (0.3.3) 
Using treetop (1.4.14) 
Using mail (2.5.4) 
Using actionmailer (3.2.13) 
Using arel (3.0.2) 
Using tzinfo (0.3.37) 
Using activerecord (3.2.13) 
Using activeresource (3.2.13) 
Using coffee-script-source (1.6.2) 
Using execjs (1.4.0) 
Using coffee-script (2.2.0) 
Using rack-ssl (1.3.3) 
Using json (1.8.0) 
Using rdoc (3.12.2) 
Using thor (0.18.1) 
Using railties (3.2.13) 
Using coffee-rails (3.2.2) 
Using commonjs (0.2.6) 
Using jquery-rails (3.0.1) 
Using less (2.3.2) 
Using less-rails (2.3.3) 
Using libv8 (3.11.8.17) 
Using moped (1.5.0) 
Using origin (1.1.0) 
Using mongoid (3.0.23) 
Using bundler (1.2.4) 
Using rails (3.2.13) 
Using ref (1.0.5) 
Using sass (3.2.9) 
Using sass-rails (3.2.6) 
Using therubyracer (0.11.4) 
Using twitter-bootstrap-rails (2.2.7) from git://github.com/seyhunak/twitter-bootstrap-rails.git (at master) 
Using uglifier (2.1.1) 
michaelirey commented 11 years ago

The pull request does fix up the forms, but does not address the issue when your mongoid model does not have a created_at. I would like to help out and address this. Perhaps only show created_at if the mongo model is using timestamps? Thoughts on how to best accomplish this?

kixorz commented 11 years ago

You need to add include Mongoid::Timestamps to your model, this will add created_at and updated_at fields.

rshiva commented 10 years ago

@michaelirey :thumbsup: for the first line "... right now they dont love each other" :smile_cat:

toadkicker commented 10 years ago

I'm closing out issues here, please reopen or create a new issue if this persists.