Asset filtered out and will not be served: add `config.assets.precompile

Responding to urging from Heroku, the Rails maintainers have merged sanity checks from the sprockets_better_errors gem into Rails 4.1. See https://github.com/rails/sprockets-rails/pull/84 The intent is to reveal asset pipeline errors that you would see in production when you run the app in development mode. You probably are using a javascript_include_tag in an application layout instead of … Read more

Rails Responds with 404 on CORS Preflight Options Request

Here’s a solution with the rack-cors gem, which you said you tried. As others have mentioned, you didn’t give much detail in regards to which front-end framework you’re using and what the actual request looks like. So the following may not apply to you, but I hope it helps someone. In my case, the gem … Read more

Rails NoMethodError: undefined method new for BigDecimal:Class

As per the documentation of BigDecimal, for all Ruby versions 2.6.x, you should be using BigDecimal with a specific version: The differences among versions are given below: version characteristics Supported ruby version range 2.0.0 You cannot use BigDecimal.new and do subclassing 2.4 .. 1.4.x BigDecimal.new and subclassing always prints warning. 2.3 .. 2.6 1.3.5 You … Read more

“undefined method `env’ for nil:NilClass” in ‘setup_controller_for_warden’ error when testing Devise using Rspec

In Rails 5 you must include Devise::Test::IntegrationHelpers instead Devise::Test::ControllerHelpers: # rails_helper.rb config.include Devise::Test::IntegrationHelpers, type: :feature See more: https://github.com/plataformatec/devise/issues/3913#issuecomment https://github.com/plataformatec/devise/pull/4071

Removing default value from Rails Migration

Create a new migration and use change_column_default. http://apidock.com/rails/ActiveRecord/ConnectionAdapters/SchemaStatements/change_column_default Sets a new default value for a column: change_column_default(:suppliers, :qualification, ‘new’) change_column_default(:accounts, :authorized, 1) Setting the default to nil effectively drops the default: change_column_default(:users, :email, nil)

Rails 4 default scope

Should be only: class Ticket < ActiveRecord::Base default_scope -> { order(:external_updated_at) } end default_scope accept a block, lambda is necessary for scope(), because there are 2 parameters, name and block: class Shirt < ActiveRecord::Base scope :red, -> { where(color: ‘red’) } end

What is the equivalent of the has_many ‘conditions’ option in Rails 4?

Needs to be the second arg: class Customer < ActiveRecord::Base has_many :orders, -> { where processed: true } end http://edgeguides.rubyonrails.org/association_basics.html#scopes-for-has-many RESPONSE TO UPDATE: Put the order inside the block: has_many :friends, -> { where(friendship: {status: ‘accepted’}).order(‘first_name DESC’) }, :through => :friendships

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