Forums » General Forum »
Lockdown messing with model validation?
Added by macario ortega 169 days ago
hi,
I have a model (Evento) that validates_associated :icono, :poster, :natura_dates, it passes the validation specs I made and if functional.
But when I include classy inheritance and lockdown in the environment.rb the model no longer passes the specs raising an ArgumentError: wrong number of arguments (3 for 2) and If I refresh any page in the browser (doensn't even have to relate to this model) I get an error:
ArgumentError in NoticiasController#index
wrong number of arguments (3 for 2)
RAILS_ROOT: /Users/macario/app
Application Trace | Framework Trace | Full Trace
app/models/evento.rb:14:in `validates_associated'
app/models/evento.rb:14
How does this relates to lockdown? what can I do to fix it?
Thanks
Replies
RE: Lockdown messing with model validation? - Added by Andrew Stone 169 days ago
Can you post your evento.rb and a full trace?
RE: Lockdown messing with model validation? - Added by macario ortega 169 days ago
Shure, hope isn't too messy:
class Evento < ActiveRecord::Base end
has_one :icono, :dependent => :destroy
has_one :poster, :dependent => :destroy
has_many :natural_dates, :dependent => :destroy
has_and_belongs_to_many :dias
CATEGORIAS = {'todas' => 'Todas las categorías', 'musica' => 'Música', 'danza' => 'Danza', 'teatro' => 'Teatro', 'artes-visuales' => 'Artes visuales', 'arte-tecnologia' => 'Artes y tecnología', 'cine' => 'Cine', 'infantiles' => 'Infantiles', 'vida-academica' => 'Vida académica', 'educacion-a-distancia' => 'Educación a distancia', 'virtuales' => 'Exposiciones virtuales', 'estados' => 'Cartelera en Centros Estatales'}
validates_presence_of :nombre, :duracion, :publico, :locacion, :costo, :cupo, :descripcion, :categoria
validates_uniqueness_of :nombre
after_update :save_natural_dates
validates_associated :icono, :poster, :natural_dates
named_scope :categoria, lambda{ |*args| { :conditions => [ 'categoria LIKE ?', (args.first) ? args.first : '%' ] } }
named_scope :joins_dias, :joins => :dias
named_scope :include_dias, :include => :dias
named_scope :month, lambda{ |*args| from = Date.civil( args[1] || Date.today.year, args.first ); { :conditions => [ 'dias.date >= ? AND dias.date < ?', from, from >> 1] } }
def validate
errors.add :poster_uploaded_data, "Debe subir una imagen para promover en portada" if self.promover_en_portada && !self.poster
errors.add :base, "Debe especificar por lo menos una fecha" if self.natural_dates.empty?
end
def after_validation
check_attachments
populate_dias
self.poster.vigencia = self.vigencia if self.poster
end
def self.categorias
CATEGORIAS
end
def self.test
Evento.find( :all, :include => :dia)
end
def uploaded_data=( data )
self.icono = Icono.new( :uploaded_data => data ) unless data.to_s.empty?
end
def poster_uploaded_data=( data )
self.poster = Poster.new( :uploaded_data => data ) unless data.to_s.empty?
end
def new_natural_date_attributes=(natural_date_attributes)
natural_date_attributes.each { |nat| self.natural_dates.build( nat ) }
end
def existing_natural_date_attributes=(natural_date_attributes)
# Keep just existing natural dates from natural dates
natural_dates.reject(&:new_record?).each do |natural_date|
#retrieve from array
attributes = natural_date_attributes[natural_date.id.to_s]
attributes ? (natural_date.attributes = attributes) : natural_dates.delete(natural_date)
end
end
def natural_dates_to_s
if natural_dates.size > 1
natural_dates[(0..-2)].collect{ |d| d.date }.join(', ') << ' y ' << natural_dates[-1].date
else
natural_dates[0].date
end
end
private
def check_attachments
check_attachment_validation self.poster, :poster_uploaded_data
check_attachment_validation self.icono, :uploaded_data
end
def populate_dias
fechas = self.natural_dates.collect{ |nat| nat.dias }.flatten
self.dia_ids = fechas.collect{ |d| r = Dia.find_or_initialize_by_date( d ); r.save if r.new_record?; r.id }
self.vigencia = fechas.sort[-1]
end
def sanitize(fechas)
fechas.sub(/ene/i, 'jan').sub(/abr/i, 'apr').sub(/ago/i, 'aug').sub(/dic/, 'dec') # fix month names perharps we could use i18n
end
def save_natural_dates
natural_dates.each do |natural_date|
natural_date.save(false)
end
end
def check_attachment_validation( attachment, field )
if attachment
unless attachment.valid?
errors.add field, attachment.errors.on(:uploaded_data)
end
end
end
And the full trace:
ArgumentError in NoticiasController#index
wrong number of arguments (3 for 2)
RAILS_ROOT: /Users/sistemasinteractivos/Sites/maqueta_cna
Application Trace | Framework Trace | Full Trace
app/models/evento.rb:14:in `validates_associated'
app/models/evento.rb:14
(DELEGATION):2:in `__send__'
(DELEGATION):2:in `with_scope'
(DELEGATION):2:in `__send__'
(DELEGATION):2:in `with_scope'
(DELEGATION):2:in `__send__'
(DELEGATION):2:in `with_scope'
(DELEGATION):2:in `__send__'
(DELEGATION):2:in `with_scope'
(DELEGATION):2:in `__send__'
(DELEGATION):2:in `with_scope'
(DELEGATION):2:in `__send__'
(DELEGATION):2:in `with_scope'
app/models/poster.rb:40:in `count_visible'
app/models/poster.rb:22:in `portada'
app/controllers/noticias_controller.rb:43:in `poster_rotate'
app/controllers/noticias_controller.rb:37:in `navigation'
vendor/rails/activesupport/lib/active_support/dependencies.rb:215:in `load_without_new_constant_marking'
vendor/rails/activesupport/lib/active_support/dependencies.rb:215:in `load_file'
vendor/rails/activesupport/lib/active_support/dependencies.rb:354:in `new_constants_in'
vendor/rails/activesupport/lib/active_support/dependencies.rb:214:in `load_file'
vendor/rails/activesupport/lib/active_support/dependencies.rb:95:in `require_or_load'
vendor/rails/activesupport/lib/active_support/dependencies.rb:260:in `load_missing_constant'
vendor/rails/activesupport/lib/active_support/dependencies.rb:467:in `const_missing'
vendor/rails/activesupport/lib/active_support/dependencies.rb:479:in `const_missing'
vendor/rails/activerecord/lib/active_record/base.rb:1907:in `compute_type'
vendor/rails/activerecord/lib/active_record/reflection.rb:129:in `send'
vendor/rails/activerecord/lib/active_record/reflection.rb:129:in `klass'
vendor/rails/activerecord/lib/active_record/associations.rb:1786:in `initialize'
vendor/rails/activerecord/lib/active_record/associations.rb:1981:in `new'
vendor/rails/activerecord/lib/active_record/associations.rb:1981:in `build_join_association'
vendor/rails/activerecord/lib/active_record/associations.rb:1665:in `build'
vendor/rails/activerecord/lib/active_record/associations.rb:1589:in `initialize'
vendor/rails/activerecord/lib/active_record/base.rb:1561:in `new'
vendor/rails/activerecord/lib/active_record/base.rb:1561:in `add_joins!'
vendor/rails/activerecord/lib/active_record/base.rb:1558:in `each'
vendor/rails/activerecord/lib/active_record/base.rb:1558:in `add_joins!'
vendor/rails/activerecord/lib/active_record/calculations.rb:187:in `construct_calculation_sql'
vendor/rails/activerecord/lib/active_record/calculations.rb:213:in `execute_simple_calculation'
vendor/rails/activerecord/lib/active_record/calculations.rb:124:in `calculate'
vendor/rails/activerecord/lib/active_record/calculations.rb:120:in `catch'
vendor/rails/activerecord/lib/active_record/calculations.rb:120:in `calculate'
vendor/rails/activerecord/lib/active_record/calculations.rb:46:in `count'
vendor/rails/activerecord/lib/active_record/named_scope.rb:153:in `send'
vendor/rails/activerecord/lib/active_record/named_scope.rb:153:in `method_missing'
vendor/rails/activerecord/lib/active_record/base.rb:1852:in `with_scope'
vendor/rails/activerecord/lib/active_record/named_scope.rb:152:in `method_missing'
vendor/rails/activerecord/lib/active_record/named_scope.rb:153:in `send'
vendor/rails/activerecord/lib/active_record/named_scope.rb:153:in `method_missing'
vendor/rails/activerecord/lib/active_record/base.rb:1852:in `with_scope'
vendor/rails/activerecord/lib/active_record/named_scope.rb:152:in `method_missing'
vendor/rails/activerecord/lib/active_record/named_scope.rb:153:in `send'
vendor/rails/activerecord/lib/active_record/named_scope.rb:153:in `method_missing'
vendor/rails/activerecord/lib/active_record/base.rb:1852:in `with_scope'
vendor/rails/activerecord/lib/active_record/named_scope.rb:152:in `method_missing'
vendor/rails/activesupport/lib/active_support/callbacks.rb:173:in `send'
vendor/rails/activesupport/lib/active_support/callbacks.rb:173:in `evaluate_method'
vendor/rails/activesupport/lib/active_support/callbacks.rb:161:in `call'
vendor/rails/actionpack/lib/action_controller/filters.rb:430:in `call'
vendor/rails/actionpack/lib/action_controller/filters.rb:592:in `run_before_filters'
vendor/rails/actionpack/lib/action_controller/filters.rb:578:in `call_filters'
vendor/rails/actionpack/lib/action_controller/filters.rb:573:in `perform_action_without_benchmark'
vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
vendor/rails/actionpack/lib/action_controller/rescue.rb:201:in `perform_action_without_caching'
vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:13:in `perform_action'
vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache'
vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in `cache'
vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:12:in `perform_action'
vendor/rails/actionpack/lib/action_controller/base.rb:529:in `send'
vendor/rails/actionpack/lib/action_controller/base.rb:529:in `process_without_filters'
vendor/rails/actionpack/lib/action_controller/filters.rb:569:in `process_without_session_management_support'
vendor/rails/actionpack/lib/action_controller/session_management.rb:130:in `process'
vendor/rails/actionpack/lib/action_controller/base.rb:389:in `process'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:149:in `handle_request'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:107:in `dispatch'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `synchronize'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `dispatch'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:120:in `dispatch_cgi'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:35:in `dispatch'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb:78:in `process'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb:76:in `synchronize'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb:76:in `process'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:618:in `process_client'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:617:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:617:in `process_client'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in `run'
/System/Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/ruby_addition.rb:110:in `initialize'
/System/Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/ruby_addition.rb:110:in `pre_rubycocoa_new'
/System/Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/ruby_addition.rb:110:in `new'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in `initialize'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in `new'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/configurator.rb:271:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/configurator.rb:270:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/configurator.rb:270:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails:127:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/command.rb:211:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails:243
vendor/rails/activesupport/lib/active_support/dependencies.rb:502:in `load'
vendor/rails/activesupport/lib/active_support/dependencies.rb:502:in `load'
vendor/rails/activesupport/lib/active_support/dependencies.rb:354:in `new_constants_in'
vendor/rails/activesupport/lib/active_support/dependencies.rb:502:in `load'
vendor/rails/railties/lib/commands/servers/mongrel.rb:64
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `require'
vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in `require'
vendor/rails/activesupport/lib/active_support/dependencies.rb:354:in `new_constants_in'
vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in `require'
vendor/rails/railties/lib/commands/server.rb:39
script/server:3:in `require'
script/server:3
app/models/evento.rb:14:in `validates_associated'
app/models/evento.rb:14
vendor/rails/activesupport/lib/active_support/dependencies.rb:215:in `load_without_new_constant_marking'
vendor/rails/activesupport/lib/active_support/dependencies.rb:215:in `load_file'
vendor/rails/activesupport/lib/active_support/dependencies.rb:354:in `new_constants_in'
vendor/rails/activesupport/lib/active_support/dependencies.rb:214:in `load_file'
vendor/rails/activesupport/lib/active_support/dependencies.rb:95:in `require_or_load'
vendor/rails/activesupport/lib/active_support/dependencies.rb:260:in `load_missing_constant'
vendor/rails/activesupport/lib/active_support/dependencies.rb:467:in `const_missing'
vendor/rails/activesupport/lib/active_support/dependencies.rb:479:in `const_missing'
vendor/rails/activerecord/lib/active_record/base.rb:1907:in `compute_type'
vendor/rails/activerecord/lib/active_record/reflection.rb:129:in `send'
vendor/rails/activerecord/lib/active_record/reflection.rb:129:in `klass'
vendor/rails/activerecord/lib/active_record/associations.rb:1786:in `initialize'
vendor/rails/activerecord/lib/active_record/associations.rb:1981:in `new'
vendor/rails/activerecord/lib/active_record/associations.rb:1981:in `build_join_association'
vendor/rails/activerecord/lib/active_record/associations.rb:1665:in `build'
vendor/rails/activerecord/lib/active_record/associations.rb:1589:in `initialize'
vendor/rails/activerecord/lib/active_record/base.rb:1561:in `new'
vendor/rails/activerecord/lib/active_record/base.rb:1561:in `add_joins!'
vendor/rails/activerecord/lib/active_record/base.rb:1558:in `each'
vendor/rails/activerecord/lib/active_record/base.rb:1558:in `add_joins!'
vendor/rails/activerecord/lib/active_record/calculations.rb:187:in `construct_calculation_sql'
vendor/rails/activerecord/lib/active_record/calculations.rb:213:in `execute_simple_calculation'
vendor/rails/activerecord/lib/active_record/calculations.rb:124:in `calculate'
vendor/rails/activerecord/lib/active_record/calculations.rb:120:in `catch'
vendor/rails/activerecord/lib/active_record/calculations.rb:120:in `calculate'
vendor/rails/activerecord/lib/active_record/calculations.rb:46:in `count'
vendor/rails/activerecord/lib/active_record/named_scope.rb:153:in `send'
vendor/rails/activerecord/lib/active_record/named_scope.rb:153:in `method_missing'
vendor/rails/activerecord/lib/active_record/base.rb:1852:in `with_scope'
(DELEGATION):2:in `__send__'
(DELEGATION):2:in `with_scope'
vendor/rails/activerecord/lib/active_record/named_scope.rb:152:in `method_missing'
vendor/rails/activerecord/lib/active_record/named_scope.rb:153:in `send'
vendor/rails/activerecord/lib/active_record/named_scope.rb:153:in `method_missing'
vendor/rails/activerecord/lib/active_record/base.rb:1852:in `with_scope'
(DELEGATION):2:in `__send__'
(DELEGATION):2:in `with_scope'
(DELEGATION):2:in `__send__'
(DELEGATION):2:in `with_scope'
vendor/rails/activerecord/lib/active_record/named_scope.rb:152:in `method_missing'
vendor/rails/activerecord/lib/active_record/named_scope.rb:153:in `send'
vendor/rails/activerecord/lib/active_record/named_scope.rb:153:in `method_missing'
vendor/rails/activerecord/lib/active_record/base.rb:1852:in `with_scope'
(DELEGATION):2:in `__send__'
(DELEGATION):2:in `with_scope'
(DELEGATION):2:in `__send__'
(DELEGATION):2:in `with_scope'
(DELEGATION):2:in `__send__'
(DELEGATION):2:in `with_scope'
vendor/rails/activerecord/lib/active_record/named_scope.rb:152:in `method_missing'
app/models/poster.rb:40:in `count_visible'
app/models/poster.rb:22:in `portada'
app/controllers/noticias_controller.rb:43:in `poster_rotate'
app/controllers/noticias_controller.rb:37:in `navigation'
vendor/rails/activesupport/lib/active_support/callbacks.rb:173:in `send'
vendor/rails/activesupport/lib/active_support/callbacks.rb:173:in `evaluate_method'
vendor/rails/activesupport/lib/active_support/callbacks.rb:161:in `call'
vendor/rails/actionpack/lib/action_controller/filters.rb:430:in `call'
vendor/rails/actionpack/lib/action_controller/filters.rb:592:in `run_before_filters'
vendor/rails/actionpack/lib/action_controller/filters.rb:578:in `call_filters'
vendor/rails/actionpack/lib/action_controller/filters.rb:573:in `perform_action_without_benchmark'
vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
vendor/rails/actionpack/lib/action_controller/rescue.rb:201:in `perform_action_without_caching'
vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:13:in `perform_action'
vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache'
vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in `cache'
vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:12:in `perform_action'
vendor/rails/actionpack/lib/action_controller/base.rb:529:in `send'
vendor/rails/actionpack/lib/action_controller/base.rb:529:in `process_without_filters'
vendor/rails/actionpack/lib/action_controller/filters.rb:569:in `process_without_session_management_support'
vendor/rails/actionpack/lib/action_controller/session_management.rb:130:in `process'
vendor/rails/actionpack/lib/action_controller/base.rb:389:in `process'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:149:in `handle_request'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:107:in `dispatch'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `synchronize'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `dispatch'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:120:in `dispatch_cgi'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:35:in `dispatch'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb:78:in `process'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb:76:in `synchronize'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb:76:in `process'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:618:in `process_client'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:617:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:617:in `process_client'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in `run'
/System/Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/ruby_addition.rb:110:in `initialize'
/System/Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/ruby_addition.rb:110:in `pre_rubycocoa_new'
/System/Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/ruby_addition.rb:110:in `new'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in `initialize'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in `new'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/configurator.rb:271:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/configurator.rb:270:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/configurator.rb:270:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails:127:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/command.rb:211:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails:243
vendor/rails/activesupport/lib/active_support/dependencies.rb:502:in `load'
vendor/rails/activesupport/lib/active_support/dependencies.rb:502:in `load'
vendor/rails/activesupport/lib/active_support/dependencies.rb:354:in `new_constants_in'
vendor/rails/activesupport/lib/active_support/dependencies.rb:502:in `load'
vendor/rails/railties/lib/commands/servers/mongrel.rb:64
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `require'
vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in `require'
vendor/rails/activesupport/lib/active_support/dependencies.rb:354:in `new_constants_in'
vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in `require'
vendor/rails/railties/lib/commands/server.rb:39
script/server:3:in `require'
script/server:3
Aparently it has to do with named scopes.
What is strange is I get no errors on refresh when I only pass two args to validates_associated and if I don't require lockdown and classy inheritance it accepts the three arguments.
RE: Lockdown messing with model validation? - Added by macario ortega 169 days ago
that end obviously goes at the end of the class.
RE: Lockdown messing with model validation? - Added by Andrew Stone 169 days ago
Can I see the poster.rb..it looks like the error is on:
app/models/poster.rb:40:in `count_visible'
RE: Lockdown messing with model validation? - Added by macario ortega 169 days ago
yep:
class Poster < ActiveRecord::Base
belongs_to :evento
do |attr_name|
enum = attachment_options[attr_name]
unless enum.nil? || enum.include?(send(attr_name))
errors.add(:uploaded_data, "El formato de la imagen debe ser gif, jpg o png")
end
end
# Images should be less than...
do |attr_name|
enum = attachment_options[attr_name]
unless enum.nil? || enum.include?(send(attr_name))
errors.add(:uploaded_data, "El archivo no puede ser mas grande de 400kb")
end
end
end
end
endRE: Lockdown messing with model validation? - Added by Andrew Stone 169 days ago
This doesn't look like a Lockdown issue, please look at this link
thanks,
andy
RE: Lockdown messing with model validation? - Added by macario ortega 169 days ago
I have some problem's with the formatting so here it goes the poster.rb
poster.rb (2.1 KB)
RE: Lockdown messing with model validation? - Added by macario ortega 169 days ago
Thing is if I don't use Lockdown everithing is fine, I will check it out. Thanks a lot!!
RE: Lockdown messing with model validation? - Added by Andrew Stone 169 days ago
Hmmm, maybe it's in the classy-inheritance though...I'm still thinking.?.
RE: Lockdown messing with model validation? - Added by macario ortega 169 days ago
I don't get a SQL problem, and the pure model specs also fail even on creation unless I pass only two arguments to validates_associated
RE: Lockdown messing with model validation? - Added by Andrew Stone 169 days ago
Yeah, the problem is with the classy-inheritance lib that's included as part of Lockdown. I'll remove that method now.
RE: Lockdown messing with model validation? - Added by macario ortega 169 days ago
Nice!!! I wish I could contribute to the project but I am not that experienced. Thanks for the link it will help me with other issue.
RE: Lockdown messing with model validation? - Added by Andrew Stone 169 days ago
I just released classy inheritance version 0.6.1 and lockdown version 0.5.17 to address your issue. please let me know if this does the trick.
thanks,
andy
RE: Lockdown messing with model validation? - Added by macario ortega 169 days ago
Right I will get it now.
RE: Lockdown messing with model validation? - Added by macario ortega 169 days ago
BTW is not available as a gem is it? where I can get them? where do I put them?
RE: Lockdown messing with model validation? - Added by Andrew Stone 169 days ago
It takes a little while to propagate, give it 20 minutes or so, then just do gem update lockdown and it will update.
RE: Lockdown messing with model validation? - Added by macario ortega 168 days ago
Ok, I updated the gem and my tests are now passing. Thanks!
RE: Lockdown messing with model validation? - Added by Andrew Stone 168 days ago
Thanks for bringing this to my attention. :)