Coder Social home page Coder Social logo

enumerate_by's People

Contributors

djmaze avatar mschuerig avatar obrie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

enumerate_by's Issues

Xml serialization on plugin models

Emmanuel Nicolau opened this issue

If there is a model in a plugin thats get loaded before enumerate_by (like Tag in acts-as-taggable-on), then a call to Tag.new.to_xml raise this error:

NoMethodError: You have a nil object when you didn’t expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
from /Users/Emma/Code/prueba/vendor/plugins/enumerate_by/lib/enumerate_by/extensions/serializer.rb:97:in enumeration_association_for’ from /Users/Emma/Code/prueba/vendor/plugins/enumerate_by/lib/enumerate_by/extensions/serializer.rb:63:inserializable_attribute_names’
from /Users/Emma/Code/prueba/vendor/plugins/enumerate_by/lib/enumerate_by/extensions/serializer.rb:63:in map!’ from /Users/Emma/Code/prueba/vendor/plugins/enumerate_by/lib/enumerate_by/extensions/serializer.rb:63:inserializable_attribute_names’
from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/serializers/xml_serializer.rb:199:in serializable_attributes’ from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/serializers/xml_serializer.rb:210:inadd_attributes’
from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/serializers/xml_serializer.rb:271:in serialize’ from /Library/Ruby/Gems/1.8/gems/builder-2.1.2/lib/builder/xmlbase.rb:134:incall’
from /Library/Ruby/Gems/1.8/gems/builder-2.1.2/lib/builder/xmlbase.rb:134:in _nested_structures’ from /Library/Ruby/Gems/1.8/gems/builder-2.1.2/lib/builder/xmlbase.rb:58:inmethod_missing’
from /Library/Ruby/Gems/1.8/gems/builder-2.1.2/lib/builder/xmlbase.rb:31:in tag!’ from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/serializers/xml_serializer.rb:270:inserialize’
from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/serialization.rb:93:in to_s’ from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/serializers/xml_serializer.rb:156:into_xml’
from (irb):1

original LH ticket

This ticket has 0 attachment(s).

uninitialized constant ActiveRecord::Serialization::Serializer on Rails 3 RC

Emmanuel Nicolau opened this issue

@@@ ruby

uninitialized constant ActiveRecord::Serialization::Serializer
/Users/Emma/.rvm/gems/ruby-1.9.2-rc2/gems/enumerate_by-0.4.4/lib/enumerate_by/extensions/serializer.rb:115:in <top (required)>&rsquo; /Users/Emma/.rvm/gems/ruby-1.9.2-rc2/gems/enumerate_by-0.4.4/lib/enumerate_by.rb:3:in<top (required)>’
/Users/Emma/.rvm/gems/ruby-1.9.2-rc2/gems/bundler-1.0.0.rc.2/lib/bundler/runtime.rb:64:in require&rsquo; /Users/Emma/.rvm/gems/ruby-1.9.2-rc2/gems/bundler-1.0.0.rc.2/lib/bundler/runtime.rb:64:inblock (2 levels) in require’
/Users/Emma/.rvm/gems/ruby-1.9.2-rc2/gems/bundler-1.0.0.rc.2/lib/bundler/runtime.rb:62:in each&rsquo; /Users/Emma/.rvm/gems/ruby-1.9.2-rc2/gems/bundler-1.0.0.rc.2/lib/bundler/runtime.rb:62:inblock in require’
/Users/Emma/.rvm/gems/ruby-1.9.2-rc2/gems/bundler-1.0.0.rc.2/lib/bundler/runtime.rb:51:in each&rsquo; /Users/Emma/.rvm/gems/ruby-1.9.2-rc2/gems/bundler-1.0.0.rc.2/lib/bundler/runtime.rb:51:inrequire’
/Users/Emma/.rvm/gems/ruby-1.9.2-rc2/gems/bundler-1.0.0.rc.2/lib/bundler.rb:114:in `require’
...
@@@

original LH ticket

This ticket has 0 attachment(s).

Proper handling of table-less model in acts_as_enumeration

Paweł Kondzior opened this issue

In rails 2.3.1 simple model with is acting as enumeration can’t handle case when there is no table in db, example:

@@@
class TicketStatus < ActiveRecord::Base
acts_as_enumeration
end
@@@

in console

@@@

TicketStatus
=> TicketStatusTable doesnt exist
@@@

And fallowing errors in log:

Mysql::Error: Table ’servicedesk3_production.ticket_statuses’ doesn’t exist: SHOW FIELDS FROM ticket_statuses

original LH ticket

This ticket has 0 attachment(s).

Frozen has_many enums?

Emmanuel Nicolau opened this issue

@@@ ruby
class Car < ActiveRecord::Base
has_many :wheel_types
end

class WheelType < ActiveRecord::Base
enumerate_by :name

bootstrap(
{:id => 1, :name => ’big’},
{:id => 2, :name => ’small’}
)
end

Car.create.reload.wheel_types.frozen?
=> true
@@@

This happens with has_many :through too.

original LH ticket

This ticket has 0 attachment(s).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.