muratguzel / letsrate

The best way to add rating capabilities to your rails application and your activerecord models.
http://letsrate.herokuapp.com
198 stars 234 forks source link

Rails 4.1 compatibility? #76

Open calebhaye opened 10 years ago

calebhaye commented 10 years ago

Doesn't seem to work with Rails 4.1 ... tried 1.0.8 and latest

$ rails g letsrate User
  create  app/assets/javascripts/jquery.raty.js
  create  app/assets/images/star-on.png
  create  app/assets/images/star-off.png
  create  app/assets/images/star-half.png
  create  app/assets/javascripts/letsrate.js.erb
  create  app/controllers/rater_controller.rb
  create  app/models/rate.rb
  create  app/models/rating_cache.rb
   route  match '/rate' => 'rater#create', :as => 'rate'
/Users/foo/.rvm/gems/ruby-2.1.2@bar/gems/letsrate-1.0.8/lib/generators/letsrate/letsrate_generator.rb:36:in `create_migration': wrong number of arguments (3 for 0) (ArgumentError)
from /Users/foo/.rvm/gems/ruby-2.1.2@bar/gems/railties-4.1.1/lib/rails/generators/migration.rb:63:in `migration_template'
from /Users/foo/.rvm/gems/ruby-2.1.2@bar/gems/letsrate-1.0.8/lib/generators/letsrate/letsrate_generator.rb:32:in `create_cacheable_migration'
jonathonjones commented 9 years ago

I ran into the same issue.

As a workaround, you can just manually create the appropriate migrations and then copy and paste the code from the templates into the generated migrations.

orbanbotond commented 9 years ago

+1 for mer too.

/Users/boti/.rvm/gems/ruby-2.0.0-p353@dime/gems/letsrate-1.0.9/lib/generators/letsrate/letsrate_generator.rb:37:in create_migration': wrong number of arguments (3 for 0) (ArgumentError) from /Users/boti/.rvm/gems/ruby-2.0.0-p353@dime/gems/railties-4.1.5/lib/rails/generators/migration.rb:63:inmigration_template' from /Users/boti/.rvm/gems/ruby-2.0.0-p353@dime/gems/letsrate-1.0.9/lib/generators/letsrate/letsrate_generator.rb:33:in create_cacheable_migration' from /Users/boti/.rvm/gems/ruby-2.0.0-p353@dime/gems/thor-0.19.1/lib/thor/command.rb:27:inrun' from /Users/boti/.rvm/gems/ruby-2.0.0-p353@dime/gems/thor-0.19.1/lib/thor/invocation.rb:126:in invoke_command' from /Users/boti/.rvm/gems/ruby-2.0.0-p353@dime/gems/thor-0.19.1/lib/thor/invocation.rb:133:inblock in invoke_all' from /Users/boti/.rvm/gems/ruby-2.0.0-p353@dime/gems/thor-0.19.1/lib/thor/invocation.rb:133:in each' from /Users/boti/.rvm/gems/ruby-2.0.0-p353@dime/gems/thor-0.19.1/lib/thor/invocation.rb:133:inmap' from /Users/boti/.rvm/gems/ruby-2.0.0-p353@dime/gems/thor-0.19.1/lib/thor/invocation.rb:133:in invoke_all' from /Users/boti/.rvm/gems/ruby-2.0.0-p353@dime/gems/thor-0.19.1/lib/thor/group.rb:232:indispatch' from /Users/boti/.rvm/gems/ruby-2.0.0-p353@dime/gems/thor-0.19.1/lib/thor/base.rb:440:in start' from /Users/boti/.rvm/gems/ruby-2.0.0-p353@dime/gems/railties-4.1.5/lib/rails/generators.rb:157:ininvoke' from /Users/boti/.rvm/gems/ruby-2.0.0-p353@dime/gems/railties-4.1.5/lib/rails/commands/generate.rb:11:in <top (required)>' from /Users/boti/.rvm/gems/ruby-2.0.0-p353@dime/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:inrequire' from /Users/boti/.rvm/gems/ruby-2.0.0-p353@dime/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in block in require' from /Users/boti/.rvm/gems/ruby-2.0.0-p353@dime/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:232:inload_dependency' from /Users/boti/.rvm/gems/ruby-2.0.0-p353@dime/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in require' from /Users/boti/.rvm/gems/ruby-2.0.0-p353@dime/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:135:ingenerate_or_destroy' from /Users/boti/.rvm/gems/ruby-2.0.0-p353@dime/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:51:in generate' from /Users/boti/.rvm/gems/ruby-2.0.0-p353@dime/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:40:inrun_command!' from /Users/boti/.rvm/gems/ruby-2.0.0-p353@dime/gems/railties-4.1.5/lib/rails/commands.rb:17:in <top (required)>' from ./bin/rails:4:inrequire' from ./bin/rails:4:in `

'

sungwoncho commented 9 years ago

There is a folk of this gem that supports Rails 4.1.5.

alfredayibonte commented 9 years ago

thanks @sungwoncho

microweb10 commented 9 years ago

FYI If you don't want to use another gem and make this one compatible with Rails 4. Just rename the method create_migration (line 37 in the file lib/generators/letsrate/letsrate_generator.rb) to something else.

Change this

def create_migration
  migration_template "migration.rb", "db/migrate/create_rates.rb"
end

To this

def create_rates_migration
  migration_template "migration.rb", "db/migrate/create_rates.rb"
end
sunil-netsol commented 8 years ago

Worked for me.

Daham94 commented 3 years ago

how to access this file /Users/daham/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/nifty-generators-0.4.6/lib/generators/nifty/scaffold/scaffold_generator.rb