gem

Finding user total votes recieved on posts by other users

穿精又带淫゛_ 提交于 2019-12-11 19:33:23
问题 I'm using this gem for comments: https://github.com/lml/commontator Which is setup to easily plug into this gem to vote on the comments: https://github.com/ryanto/acts_as_votable I'm using rails 4 btw, which is compatible with both gems. In my User model: class User < ActiveRecord::Base acts_as_voter acts_as_commentator has_many :comments end In my Comment model: class Comment < ActiveRecord::Base acts_as_votable belongs_to :user end Everything seems to be working fine. But when trying to

How do I use frozen Capistrano part 2?

孤街浪徒 提交于 2019-12-11 19:07:38
问题 Following on from my question on using frozen Capistrano a couple of days back I'm still having issues running Capistrano frozen in my vendor folder. When I try and run my frozen version of cap ruby -r rubygems ./vendor/gems/capistrano-2.5.2/bin/cap deploy-with-migrations I get an error ... RubyGem version error: net-ssh(1.0.8 not >= 2.0.0) (Gem::LoadError) ... I have net-ssh-2.0.4 frozen in my vendor folder as I knew it was a dependency so how do I make use of it? I'd hoped adding my vendor

Postgresql, problems after updating gem

▼魔方 西西 提交于 2019-12-11 19:02:49
问题 I just updated my gems. And now I have problems connecting to my postgresql database. I get the error: PGError could not connect to server: Permission denied Is the server running locally and accepting connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"? I tried uninstalling the gem and reinstalling, I also tried to change the paths file and put '/usr/local/bin/' on top. I tried some of the things from post: Repairing Postgresql after upgrading to OSX 10.7 Lion This app worked

Rmagick errors when running Rails S after upgrading to OSX Mavericks 10.9

三世轮回 提交于 2019-12-11 18:26:05
问题 I updated my osx to Mavericks 10.9 from 10.7, and since then I have been having issues running 'rails s'. The issue is with Rmagick, and I have tried almost every solution that I could find. Most people recommended reinstalling imagemagick through homebrew, and reinstalling rmagick gem, but that didn't work. I even uninstalled homebrew as a whole, and reinstalled it. I tried getting rid of gemfile.lock, and running bundle install again, but none of these worked. Here is the error message I

Ruby/Rails - Whenever gem - Loop cron tasks

一世执手 提交于 2019-12-11 18:09:11
问题 I would like to control my cron jobs through my administration page. Basically I have my cronjobs in my database, and I would like to create my crontab "on the fly". Here's an example: require "#{RAILS_ROOT}/config/environment.rb" Cron.all.each do |cron| if cron.at.blank? every eval(cron.run_interval) do cron.cmd end else every eval(cron.run_interval), :at => cron.time do cron.cmd end end end every 1.day do command "whenever --update-crontab" end But Whenever doesn't output any of the tasks

ruby mysql2 gem install error

空扰寡人 提交于 2019-12-11 18:09:08
问题 I am having problems installing mysql2 gem on my windows machine, usually it worked, but now I get Failed to build native extension. I googled around, but there were a lot of linux fixes. I know its not the best thing to work on windows with ruby. Back to the problem, I used gem install mysql2 -- --with-mysql-dir=C:\wamp\bin\mysql\mysql5.6.12\bin --with-mysql-lib=C:\wamp\bin\mysql\mysql5.6.12\lib to install mysql2, it works with mysql, but rails requires mysql2. Thank you. 回答1: mysql2 can be

undefined method `mysql_connection' for ActiveRecord::Base:Class

﹥>﹥吖頭↗ 提交于 2019-12-11 17:46:25
问题 I have upgrade rails2 to rails3 and when i try to rake db:migrate I have found following error `rake aborted!` undefined method `mysql_connection' for ActiveRecord::Base:Class /home/cis/.rvm/gems/ruby-1.9.3-p392@rails3214/gems/activerecord-3.2.14/lib/active_record/dynamic_matchers.rb:55:in `method_missing' /home/cis/.rvm/gems/ruby-1.9.3-p392@rails3214/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection' /home/cis/.rvm/gems/ruby-1.9

CSV import - with confirmation - standard solution/gem?

こ雲淡風輕ζ 提交于 2019-12-11 17:34:51
问题 In my application I wish to allow the user to upload a CSV file and then be presented with a view of their data mapped to my columns so that the user can confirm their data is correct. Ideally allowing them to edit incorrect data. Are there any existing solutions to this via a gem, any other standard solution or any resources that might help with what I want to achieve. Help very much appreciated. 回答1: you can do something like: require 'csv' file_content = File.read(params[:file].tempfile

Bundler can't find a gem that I can install using gem install

情到浓时终转凉″ 提交于 2019-12-11 16:23:52
问题 I am developing two gems side-by-side, one that contains some pure ruby functionality and one with an interface for Rails. The Rails gem (rwanda-rails) depends on the pure Ruby gem (rwanda) with spec.add_runtime_dependency "rwanda" "~> 0.6.0" in the .gemspec. However, for some reason bundler can't find this new version -- although I can install it with gem install : 15:40 slack@kevin:~/rails/rwanda-rails[master]$ gem install rwanda Successfully installed rwanda-0.6.0 Parsing documentation for

Rails app rake db:migrate aborted - syntax error

让人想犯罪 __ 提交于 2019-12-11 14:43:23
问题 I keep getting the following error when running rake db:migrate: rake aborted! syntax error on line 18, col 9: ` adapter: mysql' Tasks: TOP => db:migrate => environment (See full trace by running task with --trace) This is my database.yml file: # SQLite version 3.x # gem install sqlite3-ruby (not necessary on OS X Leopard) development: adapter: sqlite3 database: db/development.sqlite3 pool: 5 timeout: 5000 # Warning: The database defined as "test" will be erased and # re-generated from your