Differences between railties and engines in Ruby On Rails 3

Railtie can probably do what you describe, but it may be more desirable to use an engine. The engine can have its own configuration and also acts like a Rails application, since it allows you to include the /app directory with controllers, views and models in the same manner as a regular Rails app. Read … Read more

What is the purpose of config.assets.precompile?

Most assets are automatically included in asset precompilation. According to the RoR Guide on the Asset Pipeline: The default matcher for compiling files includes application.js, application.css and all files that do not end in js or css: [ /\w+\.(?!js|css).+/, /application.(css|js)$/ ] You would use config.assets.precompile if you have additional assets to include: config.assets.precompile += [‘admin.js’, … Read more

Where to override current_user helper method of devise gem

According to the module Devise::Controllers::Helpers, current_user (together with all other devise helpers) is added to ApplicationController, which means that you can override it in this way: # in application_controller.rb def devise_current_user @devise_current_user ||= warden.authenticate(scope: :user) end def current_user if params[:user_id].blank? devise_current_user else User.find(params[:user_id]) end end

bundle install problem: mysql.h is missing

I tried all the solutions posted here, but was not lucky. I reinstalled mysql with homebrew a couple of times and still no luck. Then I came across a blog post with a solution. I edited the mysql_config file in /usr/local/Cellar/mysql/5.6.12/bin and removed the W-compiler options -Wno-null-conversion and -Wno-unused-private-field for cflags and cxxflags. This solved … Read more

What’s the most secure possible Devise configuration?

Peppers: yes you are correct. There is not much additional security achieved with a pepper if you are using salt. Stretches: 12 is reasonable, however bcrypt only ensures a constant time. You should consider using the newer scrypt as it allows you to specify both a constant time and the amount of memory to use. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)