Closed anazar closed 11 years ago
@anazar - You need to use Protector.config.strong_parameters = false
instead – and I'd suggested placing it in config/initializers/protector.rb
instead of in config/application.rb
. Here's what your file should look like:
# config/initializers/protector.rb
Protector.config.strong_parameters = false
@fdeschenes not really true. @anazar is right – there should be ability to make it using Rails config, Protector has all appropriate accessors for that. I'll check it right now.
@inossidabile My bad – that said, the README suggests using Protector.config.strong_parameters = false
which is why I suggested the initializer.
I have just generated an empty Rails application. Here's how my application.rb looks:
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env)
module Foobar
class Application < Rails::Application
config.protector.strong_parameters = false
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
end
end
It works properly. Which version of Rails are you using?
@fdeschenes https://github.com/inossidabile/protector/blob/master/README.md#options, last paragraph:
Protector features basic Rails integration so you can assign options using `config.protector.option = value` at your `config/*.rb`.
So you should probably get rid of initializer too :yum:
I'm using rails4... i tried both methods...
I can't put it in the initializer file or application.rb.
That said – it works for me. Can you show me your Gemfile
and actual initializer (or config) code?
any news so far?
Closing until more details provided.
This
config.protector.strong_parameters = false
in application.rb is giving this errormethod_missing': undefined method
protector' for #Rails::Application::Configuration:0x007fccb43d8410 (NoMethodError)I also tried creating an initializer which failed as well.