Search Results

Search found 9938 results on 398 pages for 'ruby shoes'.

Page 9/398 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • What is the best way to set a database entry so that it expires after n hours using Ruby/Rails?

    - by marcgg
    My app has a token model as such: class Token < ActiveRecord::Base # The model include a few attributes including created_at end I want entries linked to this model to expire after 6 hours, meaning that they should get automatically deleted. I know that I could set a cronjob or something similar to do this, but isn't there a better/simpler way? Note: I'm using Rails 3.0.0beta3, mysql (in dev) and postgres (in prod)

    Read the article

  • Why doesn't this Ruby on Rails code work as I intend it to?

    - by Justin Meltzer
    So I attempted to build what I asked about in this question: Fix voting mechanism However, this solution doesn't work. A user can still vote however many times he or she wants. How could I fix this and/or refactor? def create @video = Video.find(params[:video_id]) @vote = @video.video_votes.new @vote.user = current_user if params[:type] == "up" @vote.value = 1 else @vote.value = -1 end if @previous_vote.nil? if @vote.save respond_to do |format| format.html { redirect_to @video } format.js end else respond_to do |format| format.html { redirect_to @video } format.js {render 'fail_create.js.erb'} end end elsif @previous_vote.value == params[:type] @previous_vote.destroy else @previous_vote.destroy if @vote.save respond_to do |format| format.html { redirect_to @video } format.js end else respond_to do |format| format.html { redirect_to @video } format.js {render 'fail_create.js.erb'} end end end @previous_vote = VideoVote.where(:video_id => params[:video_id], :user_id => current_user.id).first end

    Read the article

  • mysql error using Rails-- Please help

    - by Cypher
    Alright I am sry for the noob question but this has been driving me up a wall-especially because I got it to work yesterday and I can't remember what I did.... I am just trying to use mysql with rails with a mongrel server. I set up the server fine and can run rails applications that don't need mysql but when I create a project using (for example) rails -d mysql blog and then create some simple controller e.g. ruby script/generate Test then put this code in the controller... class TestController < ApplicationController def index render :text => 'WORK' end end then when I start the server up and open up localhost:3000/test I get the following error: = Booting Mongrel = Rails 2.3.5 application starting on http://0.0.0.0:3000 = Call with -d to detach = Ctrl-C to shutdown server /!\ FAILSAFE /!\ Mon May 10 20:15:06 -0500 2010 Status: 500 Internal Server Error Can't connect to MySQL server on 'localhost' (10061) C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapter s/mysql_adapter.rb:589:in 'real_connect' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapter s/mysql_adapter.rb:589:in 'connect' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapter s/mysql_adapter.rb:203:in 'initialize' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapter s/mysql_adapter.rb:75:in 'new' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapter s/mysql_adapter.rb:75:in 'mysql_connection' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapter s/abstract/connection_pool.rb:223:in 'send' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapter s/abstract/connection_pool.rb:223:in 'new_connection' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapter s/abstract/connection_pool.rb:245:in 'checkout_new_connection' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapter s/abstract/connection_pool.rb:188:in 'checkout' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapter s/abstract/connection_pool.rb:184:in 'loop' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapter s/abstract/connection_pool.rb:184:in 'checkout' C:/Ruby/lib/ruby/1.8/monitor.rb:242:in 'synchronize' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapter s/abstract/connection_pool.rb:183:in 'checkout' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapter s/abstract/connection_pool.rb:98:in 'connection' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapter s/abstract/connection_pool.rb:326:in 'retrieve_connection' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapter s/abstract/connection_specification.rb:123:in 'retrieve_connection' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapter s/abstract/connection_specification.rb:115:in 'connection' etc... In the browser i get a 'We're sorry, but something went wrong' Does anyone know what I am doing wrong?

    Read the article

  • Cannot use ruby-debug19 with 1.9.3-p0?

    - by Stefan Kendall
    I run this: gem install ruby-debug19 And in my cucumber env.rb file, I have this: require 'ruby-debug' When I try to run, though, I get this exception: /home/skendall/.rvm/gems/ruby-1.9.3-p0/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.so: undefined symbol: ruby_current_thread - /home/skendall/.rvm/gems/ruby-1.9.3-p0/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.so (LoadError) What do I need to do to get ruby-debug to work with 1.9.3-p0?

    Read the article

  • Missing a constant on load.. how can i get around this? (Rails::Plugin::OpenID)

    - by Chris Kimpton
    I have a Rails 2 project that I am trying to upgrade to Rails 3, but getting some issues with bundler. When I run "rake", it runs the tests just fine. But when I run "bundle exec rake" it fails to find a constant. The error is this: /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activesupport-2.3.9/lib/active_support/dependencies.rb:131:in `const_missing': uninitialized constant Rails::Plugin::OpenID (NameError) from /Users/kimptoc/Documents/ruby/borisbikes/borisbikestats.pre3/vendor/plugins/open_id_authentication/init.rb:16:in `evaluate_init_rb' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activesupport-2.3.9/lib/active_support/callbacks.rb:182:in `call' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activesupport-2.3.9/lib/active_support/callbacks.rb:182:in `evaluate_method' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activesupport-2.3.9/lib/active_support/callbacks.rb:166:in `call' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activesupport-2.3.9/lib/active_support/callbacks.rb:90:in `run' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activesupport-2.3.9/lib/active_support/callbacks.rb:90:in `each' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activesupport-2.3.9/lib/active_support/callbacks.rb:90:in `send' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activesupport-2.3.9/lib/active_support/callbacks.rb:90:in `run' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/activesupport-2.3.9/lib/active_support/callbacks.rb:276:in `run_callbacks' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/actionpack-2.3.9/lib/action_controller/dispatcher.rb:51:in `send' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/actionpack-2.3.9/lib/action_controller/dispatcher.rb:51:in `run_prepare_callbacks' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/rails-2.3.9/lib/initializer.rb:631:in `prepare_dispatcher' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/rails-2.3.9/lib/initializer.rb:185:in `process' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/rails-2.3.9/lib/initializer.rb:113:in `send' from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p330@p-borisbikestats-pre-rails3/gems/rails-2.3.9/lib/initializer.rb:113:in `run' from /Users/kimptoc/Documents/ruby/borisbikes/borisbikestats.pre3/config/environment.rb:9 from ./test/test_helper.rb:2:in `require' from ./test/test_helper.rb:2 I have these gems installed: $ gem list *** LOCAL GEMS *** actionmailer (2.3.9) actionpack (2.3.9) activerecord (2.3.9) activeresource (2.3.9) activesupport (2.3.9) authlogic (2.1.3) bundler (1.0.7) gravtastic (2.2.0) linecache (0.43) mocha (0.9.10) newrelic_rpm (2.13.4) parseexcel (0.5.2) rack (1.1.0) rack-openid (1.1.1) rails (2.3.9) rake (0.8.7) ruby-debug-base (0.10.5.jb2, 0.10.4) ruby-debug-ide (0.4.15) ruby-openid (2.1.8, 2.1.7, 2.0.4) sqlite3-ruby (1.3.2) The bundler Gemfile is as follows: source 'http://rubygems.org' #gem 'rails', '3.0.3' gem "rails", "2.3.9" gem "activesupport", "2.3.9" gem "ruby-openid", "2.1.7", :require => "openid" #gem "authlogic-oid", "1.0.4" # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'sqlite3-ruby', :require => 'sqlite3' gem "authlogic", "= 2.1.3" gem "newrelic_rpm" # gem "facebooker" gem "parseexcel" gem 'gravtastic', '= 2.2.0' gem "rack-openid", '=1.1.1', :require => 'rack/openid' # not sure what this does... gem "mocha" I have these plugins installed: 2dc_jqgrid authlogic_openid open_id_authentication squirrel I see these similar questions: Missing a constant on load.. how can i get around this? and Requiring gem in Rails 3 Controller failing with "Constant Missing" But their solutions dont seem to work for my situation. I am guessing the issue is around the plugins, but my ruby-foo is too weak. Thanks in advance, Chris

    Read the article

  • Which version of rails should I install with ruby 2.0.0 installed?

    - by Ekin Hazal
    Hi I am building a ROR development environment on a new computer with windows 7, now I have Ruby version 2.0.0 and Gems version 2.2.2 installed. Which version of Rails should I install? I saw this on rubyonrails.org/download : "We recommend Ruby 2.1.0 for use with Rails. We stopped supporting Ruby 1.8.x after Rails 3.2. Ruby 1.9.2+ will be supported until Rails 5." I will be working on a long-time project, I'm just trying to lessen the headaches I will have later. Right now, the latest Rails -v is 4.1.0 and they recommend Ruby 2.1.0 for use with Rails. I think the best option is to go with this set. Any other thoughts?

    Read the article

  • Why do I get "undefined method `destroy'" when including 'svn/repos'?

    - by Chad Johnson
    I get the following when running script/server require 'svn/repos' script/console Loading development environment (Rails 2.3.5) require 'svn/repos' /Library/Ruby/Site/1.8/svn/core.rb:88: warning: already initialized constant Stream /Library/Ruby/Site/1.8/svn/core.rb:138: warning: already initialized constant AuthBaton NoMethodError: undefined method destroy' for #<Svn::Ext::Core::Apr_pool_wrapper_t:0x10150ae68> from /Library/Ruby/Site/1.8/svn/util.rb:60:insvn_fs_initialize' from /Library/Ruby/Site/1.8/svn/util.rb:60:in call' from /Library/Ruby/Site/1.8/svn/util.rb:60:ininitialize' from /Library/Ruby/Site/1.8/svn/fs.rb:14 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:inrequire' from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in require' from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:innew_constants_in' from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in require' from /Library/Ruby/Site/1.8/svn/repos.rb:5 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:ingem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in require' from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire' from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in new_constants_in' from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire' from (irb):1 Any idea why?

    Read the article

  • ruby1.9.1 - sqlite3 problem on ubuntu 9.10 x64 (no such file to load -- sqlite3)

    - by doriath
    Hi, I have problem with sqlite3, because it is not working. irb(main):001:0> require 'sqlite3' LoadError: no such file to load -- sqlite3 from (irb):1:in `require' from (irb):1 from /usr/bin/irb:12:in `<main>' I have installed following packages: sudo apt-get install ruby1.9.1-full sudo apt-get install rubygems1.9.1 sudo gem update --system sudo apt-get install sqlite3 libsqlite3-dev sudo gem install sqlite3-ruby sudo apt-get install libopenssl-ruby1.9.1 The applications has following versions: $ ruby --version ruby 1.9.1p243 (2009-07-16 revision 24175) [x86_64-linux] $ sqlite3 --version 3.6.16 $ gem --version 1.3.6 and $ gem list --local *** LOCAL GEMS *** actionmailer (2.3.5) actionpack (2.3.5) activerecord (2.3.5) activeresource (2.3.5) activesupport (2.3.5) ffi (0.6.2) rack (1.0.1) rails (2.3.5) rake (0.8.7) rubygems-update (1.3.6) sqlite3-ruby (1.2.5) What have I missed?

    Read the article

  • Paperclip and tempfile with Rails

    - by Eric Koslow
    I'm trying to write a rails application where users can upload images, but Paperclip doesn't seem to be working for me. I've gone through all the basic steps (added has_attached_file, the migration, making the form multipart) but I keep getting the same error whenever I try uploading an image: can't convert nil into Integer Looking at the top of the stack ...rails3/lib/paperclip/processor.rb:46:in `sprintf' ...rails3/lib/paperclip/processor.rb:46:in `make_tmpname' .../ruby-1.9.2-head/lib/ruby/1.9.1/tmpdir.rb:154:in `create' .../ruby-1.9.2-head/lib/ruby/1.9.1/tempfile.rb:134:in `initialize' It seems the problem is in the tempfile. My code: _form.rb <%= form_for @high_school, :html => {:multipart => true} do |f| %> <%= f.error_messages %> ... <div class="field"> <%= f.file_field :photo %> </div> <div class="actions"> <%= f.submit %> </div> <% end %> model/high_school.rb ... validates_length_of :password, :minimum => 4, :allow_blank => true has_attached_file :photo has_many :students ... Is this a known problem? I basically followed the instructions from the github to the letter. My environment: Rails3 and Ruby 1.9.2dev Thank you!

    Read the article

  • Third-party open-source projects in .NET and Ruby and NIH syndrome

    - by Anton Gogolev
    The title might seem to be inflammatory, but it's here to catch your eye after all. I'm a professional .NET developer, but I try to follow other platforms as well. With Ruby being all hyped up (mostly due to Rails, I guess) I cannot help but compare the situation in open-source projects in Ruby and .NET. What I personally find interesting is that .NET developers are for the most part severely suffering from the NIH syndrome and are very hesitant to use someone else's code in pretty much any shape or form. Comparing it with Ruby, I see a striking difference. Folks out there have gems literally for every little piece of functionality imaginable. New projects are popping out left and right and generally are heartily welcomed. On the .NET side we have CodePlex which I personally find to be a place where abandoned projects grow old and eventually get abandoned. Now, there certainly are several well-known and maintained projects, but the number of those pales in comparison with that of Ruby. Granted, NIH on the .NET devs part comes mostly from the fact that there are very few quality .NET projects out there, let alone projects that solve their specific needs, but even if there is such a project, it's often frowned upon and is reinvented in-house. So my question is multi-fold: Do you find my observations anywhere near being correct? If so, what are your thoughts on quality and quantitiy of OSS projects in .NET? Again, if you do agree with my thoughts on "NIH in .NET", what do you think is causing it? And finally, is it Ruby's feature set & community standpoint (dynamic language, strong focus on testing) that allows for such easy integration of third-party code?

    Read the article

  • Good ruby book with exercises? [closed]

    - by watabou
    I find that I learn the best with a book that has a number of exercises at the end of each chapters. A great example of this is C++ Primer Plus by Stephen Prata or Scientific Programming with Python or the Horstmann Java books. All of those books have a number of programming exercises at the end tailored to that specific chapter. I love the styles of those book and was wondering if there is anything similar for Ruby. I've extensively searched google for this and people have been suggesting different stuff like different websites like Ruby Koans and LRTHW but honestly, I've tried those and they aren't for me. I taught myself Python with the the Hard Way book and to be honest, it's not for me. Now, forgive me if I'm blunt but does anyone have a Ruby programming BOOK (i.e. not a website), that has EXERCISES in it? I do NOT want a website, unless the book is only or is freely available online by the author, similar to the Hard Way books. I would say that I'm a intermediate level programmer with only some Ruby experience but if you know of a beginner book on Ruby, that is fine too. Thanks in advance, I would really really appreciate the help.

    Read the article

  • Ruby 1.9.3 - Bundler - Graylog2

    - by Arenstar
    im having a strange problem with bundler. Using ruby 1.8 the following works fine however not with 1.9 it always results in Could not find rake-0.9.2.2 in any of the sources Run `bundle install` to install missing gems. i dont understand why, but it functions correctly with rvm. I can not however use rvm, this is not a solution to my problem Install Ruby cd /usr/local/src wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz tar xzf ruby-1.9.3-p194.tar.gz && cd ruby-1.9.3-p194 ./configure --prefix=/opt/lp/ruby-1.9.3-test make all && make install Install Graylog cd /usr/local/src wget https://github.com/downloads/Graylog2/graylog2-web-interface/graylog2-web-interface-0.9.6p1.tar.gz tar xzf graylog2-web-interface-0.9.6p1.tar.gz cd graylog2-web-interface-0.9.6p1 Setup Graylog cd /usr/local/src/graylog2-web-interface-0.9.6p1 sed -i "3 i gem 'thin', '~> 1.3.1'" Gemfile /opt/lp/ruby-1.9.3-test/bin/gem install bundle /opt/lp/ruby-1.9.3-test/bin/bundle install --path vendor/bundle --binstubs Begin the Test cd /usr/local/src/graylog2-web-interface-0.9.6p1 /opt/lp/ruby-1.9.3/bin/bundle exec bin/rake #Could not find rake-0.9.2.2 in any of the sources #Run `bundle install` to install missing gems. cd /usr/local/src/graylog2-web-interface-0.9.6p1 /opt/lp/ruby-1.9.3/bin/bundle exec bin/thin -e production -S test.sock -c . -R config.ru start #Could not find rake-0.9.2.2 in any of the sources #Run `bundle install` to install missing gems. Where am i going wrong?

    Read the article

  • Crypted_password is null when using Authlogic to save a user

    - by kareem
    i'm getting a strange error on my production install when i try and create a new user using AL: ActiveRecord::StatementInvalid: Mysql::Error: Column 'crypted_password' cannot be null: INSERT INTO users especially strange b/c it works as expected on my local box. RUnning Rails 2.3.2 and ruby 1.8.7 on both boxes. user.rb: class User < ActiveRecord::Base before_create :set_username acts_as_authentic do |c| c.require_password_confirmation = false c.login_field = "email" c.validates_length_of_password_field_options = {:minimum => 4} c.validate_login_field = false #don't validate email field with additional validations end end Here's output from my production console: >> u = User.new => #<User id: nil, username: nil, email: nil, crypted_password: nil, password_salt: nil, persistence_token: nil, single_access_token: nil, perishable_token: nil, login_count: 0, failed_login_count: 0, last_request_at: nil, current_login_at: nil, last_login_at: nil, current_login_ip: nil, last_login_ip: nil, created_at: nil, updated_at: nil, is_admin: 0, first_name: nil, last_name: nil> >> u.full_name = 'john smith' => "john smith" >> u.password = 'test' => "test" >> u.email = '[email protected]' => "[email protected]" >> u.valid? => true >> u.save ActiveRecord::StatementInvalid: Mysql::Error: Column 'crypted_password' cannot be null: INSERT INTO `users` (`single_access_token`, `last_request_at`, `created_at`, `crypted_password`, `perishable_token`, `updated_at`, `username`, `failed_login_count`, `current_login_ip`, `password_salt`, `current_login_at`, `is_admin`, `persistence_token`, `login_count`, `last_name`, `last_login_ip`, `last_login_at`, `email`, `first_name`) VALUES('B-XSXwhO7hkbtISIOyEq', NULL, '2009-07-31 01:10:44', NULL, 'FK3mYS2Tp5Tzeq5IXE1z', '2009-07-31 01:10:44', 'john', 0, NULL, NULL, NULL, 0, '2c76b645f761eb3509353290e93874cecdb68a63caa165812ab1b126d63660757090ecf69995caef9e78f93d070b524e2542b3fec4ee050726088c2a9fdb0c9f', 0, 'smith', NULL, NULL, '[email protected]', 'john') from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/ active_record/connection_adapters/abstract_adapter.rb:212:in `log' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/ active_record/connection_adapters/mysql_adapter.rb:320:in `execute' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/ active_record/connection_adapters/abstract/database_statements.rb: 259:in `insert_sql' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/ active_record/connection_adapters/mysql_adapter.rb:330:in `insert_sql' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/ active_record/connection_adapters/abstract/database_statements.rb: 44:in `insert_without_query_dirty' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/ active_record/connection_adapters/abstract/query_cache.rb:18:in `insert' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/ active_record/base.rb:2902:in `create_without_timestamps' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/ active_record/timestamp.rb:29:in `create_without_callbacks' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/ active_record/callbacks.rb:266:in `create' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/ active_record/base.rb:2868:in `create_or_update_without_callbacks' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/ active_record/callbacks.rb:250:in `create_or_update' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/ active_record/base.rb:2539:in `save_without_validation' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/ active_record/validations.rb:1009:in `save_without_dirty' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/ active_record/dirty.rb:79:in `save_without_transactions' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/ active_record/transactions.rb:229:in `send' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/ active_record/transactions.rb:229:in `with_transaction_returning_status' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/ active_record/connection_adapters/abstract/database_statements.rb: 136:in `transaction' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/ active_record/transactions.rb:182:in `transaction' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/ active_record/transactions.rb:228:in `with_transaction_returning_status' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/ active_record/transactions.rb:196:in `save' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/ active_record/transactions.rb:208:in `rollback_active_record_state!' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/ active_record/transactions.rb:196:in `save' No idea why this is happening, and especially why this saves a new user on dev but not on production. Any help is much appreciated, thanks! edit: using Apache & Passenger 2.2.4

    Read the article

  • Read MS Word .doc file with ruby and win32ole

    - by bmalets
    I'm trying ot read .doc file with ruby, I use win32ole library. IT my code: require 'win32ole' class DocParser def initialize @content = '' end def read_file file_path begin word = WIN32OLE.connect( 'Word.Application' ) doc = word.activedocument rescue word = WIN32OLE.new( 'Word.Application' ) doc = word.documents.open( file_path ) end word.visible = false doc.sentences.each{ |x| @content I kick off doc reading with DocParser.new.read_file('path/file.doc') When I run this using rails c - I don't have any problems, it's working fine. But when I run it using rails (e.g. after button click), once in a while (every 3-4 time) this code crashes with error: WIN32OLERuntimeError (failed to create WIN32OLE object from `Word.Application' HRESULT error code:0x800401f0 CoInitialize has not been called.): lib/file_parsers/doc_parser.rb:14:in `initialize' lib/file_parsers/doc_parser.rb:14:in `new' lib/file_parsers/doc_parser.rb:14:in `rescue in read_file' lib/file_parsers/doc_parser.rb:10:in `read_file' lib/search_engine.rb:10:in `block in search' lib/search_engine.rb:43:in `block in each_file_in' lib/search_engine.rb:42:in `each_file_in' lib/search_engine.rb:8:in `search' app/controllers/home_controller.rb:9:in `search' Rendered c:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-4.1.1/lib/action_dispatch/middleware/templates/rescues/_source.erb (0.0ms) Rendered c:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-4.1.1/lib/action_dispatch/middleware/templates/rescues/_trace.text.erb (2.0ms) Rendered c:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-4.1.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.text.erb (2.0ms) Rendered c:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-4.1.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb (56.0ms) Aditionaly, this code read doc file successfully, but after a few seconds rails crashes: see this gist What is my problem? How can I fix it? Please, help!

    Read the article

  • Strengths and Weaknesses - Ruby on Rails

    - by ThePower
    I was wondering what are the strengths and weakness of using Ruby on Rails for Web Application development. I would like an insight from other developers as to why they have chosen to write in Ruby on Rails over other languages and technologies. What does Ruby on Rails provide that has the edge over other web application technologies and languages? Are there any unique capabilities that the language provides? Thanks in advance, hopefully I will be able to make the choice as to use the language or not.

    Read the article

  • Date and Time Conversion in Ruby

    - by dkris
    I am currently looking on converting Thu Jun 10 16:17:55 +0530 2010 to 15/06/2010 or 15-06-2010 using Ruby I am getting the dates from the DB as shown below. @tickets = Ticket.find(:all) for ticket in @tickets print ticket.created_at end I have been looking around for resources as I a n00b in RoR/Ruby. I have looked at Class Date Class DateTime and couldn't make much of it. Please let me know how I could achieve this conversion in Ruby.

    Read the article

  • Is Ruby on Rails slow with medium traffic?

    - by IHawk
    Hello ! I made some searches on Google, and I read some posts, articles and benchmarks about Ruby on Rails being slow and I am planning to build one website that will have a good amount of users inserting data and there will be some applications to process this data (maybe in Ruby, you can help me choosing the language). What is the real performance of Ruby on Rails with large traffic ? Thank you !

    Read the article

  • Embedding Ruby, calling a function from C

    - by ThePower
    Hi, I'm writing an app that calls ruby code from c. I am having a little difficulty and wondered if anyone could point me in the rite direction. I currently have in my C. #include ruby.h main() { ruby_init(); rb_require("myRubyFile"); rb_funcall(rb_module_new(), rb_intern("RubyFunction"), 0, NULL); } My ruby file is in the same directory as my c file and is called myRubyFile.rb and contains a definition of the function RubyFunction(). This is a cut down of what I actually want to do, just making it more readable for others. I just require some feedback as to whether this is the correct method to call ruby code from my c file. Regards

    Read the article

  • Extending Ruby, calling a function from C

    - by ThePower
    Hi, I'm writing an app that calls ruby code from c. I am having a little difficulty and wondered if anyone could point me in the rite direction. I currently have in my C. #include ruby.h main() { ruby_init(); rb_require("myRubyFile"); rb_funcall(rb_module_new(), rb_intern("RubyFunction"), 0, NULL); } My ruby file is in the same directory as my c file and is called myRubyFile.rb and contains a definition of the function RubyFunction(). This is a cut down of what I actually want to do, just making it more readable for others. I just require some feedback as to whether this is the correct method to call ruby code from my c file. Regards

    Read the article

  • Rails app w/ 2.2.0 embedd how to use ruby 1.8 vice 1.9

    - by Barb
    Hello all, I have just downloaded an app that is based on Rail 2.2.0 which is included in the app. I have just upgraded to Ruby 1.9 and I still have Ruby 1.8 on my machine. Is there a way I can tell this app to use Ruby 1.8 vice 1.9? Would it be easier to decouple the app from Rails 2.2.0 and upgrade it to Rails 2.3.6? If changing the rails would be easier, how do I do that?

    Read the article

  • Problems running Ruby on Rails apps on shared hosted server

    - by Evgeny
    I have problems installing any Ruby On Rails app on my shared hosted server. Mongrel shows html as plain text for all pages. The problem occurs for any app, even if I create a test empty app and add a scaffolded view without changing anything. It appears that the Mongrel crashes when trying to put cookies to the response header. The HTTP header looks incomplete, the Content-type and other parameters are missing: curl 127.0.0.1:12002/users -I HTTP/1.1 200 OK Connection: close Date: Wed, 26 May 2010 09:46:50 GMT Content-Length: 0 Here is the output from mongrel.log Error calling Dispatcher.dispatch #<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.[]> /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:108:in `send_cookies' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:136:in `out' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/http_response.rb:65:in `start' ruby 1.8.7 rails 2.3.8 mongrel 1.1.5 Here is the link to the test page. Has anyone seen anything like this?

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >