Remove twitter bootstrap from Rails (added via twitter-bootstrap-rails) - ruby-on-rails

How do I remove the twitter-bootstrap-rails gem and all the assets and configurations from my rails app?
I installed it with
bundle install
#and
rails g bootstrap:install

Could you just do this :
rails destroy bootstrap:install
and remove it from your Gemfile?

Related

active admin in rails 4.0.0 DEPRECATION WARNING

I am using active admin as given in Active admin install with Rails 4 . gem 'activeadmin', github: 'activeadmin' is installing.
But still i am getting error after running rails generate active_admin:install.
The error is
DEPRECATION WARNING: Support for Rails < 4.0.4 will be dropped from Formtastic 4.0. invoke devise
To use devise you need to specify it in your Gemfile. If you don't want to use devise, run the generator with --skip-users.
It means you did not install devise.
You want to
a) install devise: gem install devise, and then run rails generate active_admin:install. This will create default AdminUser object.
b) use the hint from warning, and install activeadmin with rails generate active_admin:install --skip-users.

Uninstalling simpleform gem

I have commented out gem 'simple_form' from my Gemfile with Rails Rails 3.2.12 and Ruby 2.0.0p0. When I do rails generate scaffold, I still get simple_form forms.
Is there a way to get the original form_for scaffolds instead?
The following should remove it properly:
# rails destroy simple_form:install
# bundle
Also, you can check for files in lib/templates and remove the associated ones for simple_form.
http://railscasts.com/episodes/234-simple-form?view=comments#comment_150699
http://github.com/plataformatec/simple_form/issues/680
try after installing bundle again,
bundle install

bootstrap:themed error - not generating the proper views

Rails: 3.2.6
twitter-bootstrap-rails (2.2.3, 2.1.0)
I did the following:
rails generate bootstrap:install static -s
I then generated the scaffolding for certification as follows:
rails generate scaffold certification id:integer user_id:integer name:string description:string location:string status:string --skip-stylesheets -s
Then I tried to generate the twitter bootstrap views as follows:
rails generate bootstrap:themed certifications -f -s
Which gave me the following error:
undefined method `fields' for #<Class:0x007fe5e7282060>
and no changes were made to the certifications views. Any ideas?
I had similar issues, because I was working with a mix of mongoid and active records. I guess somehow there were conflicts while using the generator and it couldn't find the fields method anymore.
The solution for me was a reinstall twitter-bootstrap-rails gem with the following:
gem "twitter-bootstrap-rails", :git => 'https://github.com/seyhunak/twitter-bootstrap-rails.git'
Also, do not forget to run
rake db:migrate
after your
rails generate scaffold ...
For those working with mongoid, additional tip: everytime I have to generate a scaffold for an active record, I comment:
#gem "mongoid", "~> 3.0"
#gem "composite_primary_keys"
Then, generate, then uncomment

Uninstalling Twitter Bootstrap from a Rails app

I recently installed Twitter Bootstrap in my Rails app via the following two steps:
rails g bootstrap:install
(this included Twitter Bootstrap to my app's asset pipeline)
rails g bootstrap:layout application fixed
(this generated a layout for me, by default application.html.erb and fixed layout was generated)
Should I do any of the following or all of it to remove Twitter Bootstrap completely from my app?
Delete all the files added by it in APP folder?
javascripts/bootstrap.js.coffee
stylesheets/bootstrap.js.coffee
layout/application.html.erb (edit this file?)
Are there other files that were created that I missed and must also remove?
Try this
rails destroy bootstrap:install
Also, remove the gem from your gemfile
gem "twitter-bootstrap-rails"
If you look at the github repo for this you can see the generators and what exactly they do:
https://github.com/seyhunak/twitter-bootstrap-rails/tree/master/lib/generators/bootstrap
The command
rails g bootstrap:install
Uses the templates here:
https://github.com/seyhunak/twitter-bootstrap-rails/tree/master/lib/generators/bootstrap/install/templates
The layout command uses the templates here:
https://github.com/seyhunak/twitter-bootstrap-rails/tree/master/lib/generators/bootstrap/layout/templates
Also, remove the gem from your gemfile
gem "twitter-bootstrap-rails"

twitter-bootstrap-rails gem workflow

How do I use the twitter-bootstrap-rails gem in my Rails 3.2.1 app? What is the workflow?
After I do:
rails g bootstrap:layout [LAYOUT_NAME] [*fixed or fluid] [options]
what do I do next? Do I just copy and paste the generated code into my view? Do I do this for every view? If so, how is doing
rails g bootstrap:themed [RESOURCE_NAME] [LAYOUT] [options]
any different?
Do you guys even use the rails generators?
Thanks
I'm the author of twitter-bootstrap-rails gem. I'll give you a quick walktrough to how to install and use twitter-bootstrap-rails.
Ruby stack;
(Ruby 1.9.3, Rails 3.1 or Rails 3.2 is required. Use RVM to get started)
After bundling gem to Gemfile by;
gem 'twitter-bootstrap-rails'
bundle install
Run install generator
rails g bootstrap:install
(it will includes Twitter Bootstrap to your app's asset pipeline)
Run layout generator
rails g bootstrap:layout application fixed
(it will generates layout for you, by default application.html.erb and fixed layout will generates)
Run themed generator (optional);
rails g scaffold post title:string description:text
(this step uses Rails generators to create CRUD stuff for you)
rake db:migrate
(migrating to database)
rails g bootstrap:themed posts
(Twitter Bootstrap compatible styling for your 'posts' views and form)
Also there is detailed documentation to install, usage and generators, coffeescript etc.
https://github.com/seyhunak/twitter-bootstrap-rails.
There is a RailsCasts tutorial that is a great starting point:
http://railscasts.com/episodes/328-twitter-bootstrap-basics
Run:
rails new APPLICATION -m anyfile.rb
anyfile.rb
gem "therubyracer"
gem "less-rails"
gem "twitter-bootstrap-rails"
generate("scaffold", "Post title:string content:text")
rake("db:create")
rake("db:migrate")
generate("bootstrap:layout", "application fluid")
generate("bootstrap:install")
generate("bootstrap:themed", "posts")
git :init
git :add => "."
git :commit => "-m First commit!"

Resources