Giter Site home page Giter Site logo

preferences's Issues

`type_cast' for nil:NilClass (NoMethodError)

Erik Dahlstrand opened this issue

When going from 0.4.1 to 0.4.2 I get

@@@ ruby
.rvm/gems/ree-1.8.7-2010.01/gems/activesupport-2.3.5/lib/active_support/whiny_nil.rb:52:in method_missing’: undefined methodtype_cast’ for nil:NilClass (NoMethodError)
.rvm/gems/ree-1.8.7-2010.01/gems/preferences-0.4.2/lib/preferences.rb:321:in preferences’ .rvm/gems/ree-1.8.7-2010.01/gems/activerecord-2.3.5/lib/active_record/base.rb:2197:ininject’
.rvm/gems/ree-1.8.7-2010.01/gems/preferences-0.4.2/lib/preferences.rb:320:in each’ .rvm/gems/ree-1.8.7-2010.01/gems/preferences-0.4.2/lib/preferences.rb:320:ininject’
.rvm/gems/ree-1.8.7-2010.01/gems/preferences-0.4.2/lib/preferences.rb:320:in `preferences’
@@@

when starting the web server.

original LH ticket

This ticket has 0 attachment(s).

preferences hash has wrong types

Gravis opened this issue

If I have a float preference, the hash preferences don’t provide a float if the value was stored as a string.
Typically, rails will update preferences with strings instead of floats.

So, even if the type is a float, the preferences hash is incorrect :

{"my_float_pref"=> "1.1"}

When I get the pref using the standard preferred method, the value is casted correctly :
user.preferred(:my_float_pref)
=> 1.1

Thanks

original LH ticket

This ticket has 0 attachment(s).

How to get the parent model (Users) based upon preference?

Sachin Sagar opened this issue

Hi,
I’ve implemented this plugin successfully and its working.
I went through all the README and lib files but couldn’t find the solution.
The problem is, how to get all the users based upon the preference name.
e.g.
@@@
I have added following in my user model:
preference :article_notification, :default => true
preference :post_notification, :default => true
@@@
Now how do I get all the users based upon the :article_notification preference?

original LH ticket

This ticket has 0 attachment(s).

rails 3 working?

sopwithpup opened this issue

trying to use in rails3.

added gem ’preferences’ to gemfile did bundle install seems to work
ran rails generate migration create_preferences,
edited to migration to create the table with timestamps
ran rake db:migrate
restated rails server
added some prefs to user model
all working

tried to access a pref using @user.prefers(:weekly_request)

got uninitialized constant Preferences::InstanceMethods::Preference

Am i missing something??

TIA

D

original LH ticket

This ticket has 0 attachment(s).

uninitialized constant Preferences::InstanceMethods::Preference

trying to use in rails3.2.14

added gem ’preferences’ to gem file did bundle install seems to work
run the rails generate migration create_preferences,
edited to migration to create the table with timestamps
ran rake db:migrate
restarted rails server
added some prefs to user model
all working

tried to access a pref using @user.prefers_publish_profile
In user model i write like this
preference :publish_profile, :default => true

got uninitialized constant Preferences::InstanceMethods::Preference

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.