How to use bootstrap, Devise and rails_layout for rails project.
I wanted my new project with rails 4. So, i started with rails with following
tasks in mind.
1. responsive using bootstrap/foundation
2. user authentication.
3. debugging
To make this task achievable there are following gem in rails.
1.devise/omniauth - for othentication
2.bootstrap-sass - for bootstrap
3.rails_layout - for layout generation
Here is the process include these in your Gemfile.
Note
gem 'rails_layout' , group: :development,
1.1 for the devise follow the following points here.
https://github.com/plataformatec/devise#getting-started
2.2 Now we have added the bootstrap in our project now, we need to generate the layout using bootstrap or foundation or Zurb.
https://github.com/plataformatec/devise#getting-started
follow the commands.
The “layout:install” Command
The command will rename application.css to application.css.scss.
It will add:
- framework_and_overrides.css.scss
3. For Debugging]
group :development do
gem 'better_errors'
gem 'binding_of_caller'
gem 'pry_rails'
gem 'meta_request'
end
4. list of helpful gems
- paperclip
- rmagic
- aws-sdk
- annotate
- roo #for csv, EXLE files
- pdfkit #for the pdf creation
- suspot # for full text search
- jazz_hands # For perfect de-bugging
- nakogiri #for pagination
- sunspot
- quite_assets
For more visit this link links to gems blog
For the file upload on the S3 bucket.
https://devcenter.heroku.com/articles/paperclip-s3
Some rails TIPS man.
1. include?
This is used to check for the word in the string.
"Hello".include? "l" => true
2. repond_to ?
This will be true if the var. will have the function to work with.
3. "hello".methods
4. "Hello".gsub!(/l/,"x");
5. in Rails to avoid SQL Injection
@tasks = Task.find(:all, :conditions => ["name LIKE ?", "%#{params[:query]}%"])
6. For the enum in the models to work.
7. Keywords for the ruby
- break
- next
- redo
- retry
- is_a? /kind_of?
- instance_of?
- kind_of?
- defined?
- to_s
- to_sym / to_intern --to_s
- upto -- downto 88.upto(90){ }
- collect / collect!
0 | As Chris said, you'll want to use a third party service like S3 and if you do end up using Paperclip then you'll eventually have something like this example in your model.
And in your config directory you'll have an s3.yml credentials file that would look like:
|
8. For the the nested resources the views.
http://stackoverflow.com/questions/16999292/examples-of-new-create-actions-for-has-many-through-associations-nested
9. Eager loading for the rails if this is needed.
10.