ruby-on-rails

What is up with my gems?

ok so i installed a gem and then ran script/server and for some reason its still telling me the gem is not installed sudo gem install paypal_adaptive Successfully installed paypal_adaptive-0.1.0 1 gem installed matt@macBookPro ~/Sites/somesite[master (Time to Commit)]$ script/server => Booting WEBrick => Rails 2.3.8 application startin...

In rails, where to put a constant (variable?) that changes based on the current date?

I have an app that heavily relies on dates. There is a moderately expensive calculation that is needed to set these dates, based on the current date. As far as each request is concerned, these dates are constants -- they don't change once created -- but they do change throughout the week. The dates are used in both controllers and models...

Considering upgrading to Rails 3

I'm thinking of upgrading a current Rails 2.3.8 / Ruby 1.8.6 app to Rails 3 / Ruby 1.8.7. Seeing that Rails 3 has been out for a month now, are there big issues that developers have ran into upgrading 2.x app besides the expected some gems aren't supported yet, deprecation warnings / methods, etc? Are there major stability issues with Ra...

Practical Queuing Theory

I want to learn enough simple/practical queuing theory to model the behavior of a standard web application stack: Load balancer with multiple application server backends. Given a simple traffic pattern extracted from a tool like NewRelic showing percentage of traffic to a given part of an application and average response time for that...

Keeping track of created model objects and destroying them after tests?

Background: Test drivers for rails that can test AJAX functionality (e.g. Selenium, EnvJS, akephalos etc) don't support transactional fixtures. I'm using Machinist and looking to do Capybara testing so I need some way to clear the test database after each test. Truncating every table in the test database is really slow (this is what the ...

Rails 3 - Using link_to but adding a # for AJAX Deep Linking

Hello, Currently my links in Rails are using link_to as follows: <%= link_to project.name, project %> Which makes something like: <a href="/projects/1">Project 1</a> I'm working to implement an AJAX app with deep linking so instead of the above, I want the output to be (with a #): <a href="#/projects/1">Project 1</a> Is there a way...

'no driver for sqlite3 found' in fresh rails install on windows 7 machine

My Gem file looks like this: source 'http://rubygems.org' gem 'rails', '3.0.0' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' #gem 'sqlite3-ruby', :require => 'sqlite3' gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3' group :development do gem 'rspec-rails', '2.0.0.beta.18' end group :tes...

Accessing a URL Param Project.find(params[:project_id]) in the application_helper.rb

Hello, I'm trying to build a helper called def current_project @current_project = Project.find(params[:project_id]) end I want this so that in the navigation plugin I'm using I can use current_project to populate the navigation. Problem I'm having is while params[:project_id] is available in the navigation config (navigation.rb...

Rails: Production Authlogic Problem with find_using_perishable_token

So I'm pretty puzzled by this one. This works in development mode and had worked in production mode before, but I just got this hoptoad error that said this: An error has just occurred. View full details at: http://goldhat.hoptoadapp.com/errors/2418099 Error Message: NoMethodError: undefined method `reset_perishable_token!' for # Wh...

Methods query in ruby on rails - undefined method `read' for ...

As part of learning ruby/rails, I'm trying to implement http://github.com/professionalnerd/simple-private-messages into my application from scratch, instead of just installing the plugin. (I know, causing myself trouble but it's a good learning experience.) I created the model, and the associations seem ok and I can create new messages ...

can't get ruby-debug on windows

Can't get ruby-debug engaged for rails 3.0 1) when I do a "gem list ruby-debug" I get: $ gem list ruby-debug * LOCAL GEMS * ruby-debug (0.10.3) ruby-debug-base (0.10.3 mswin32) ruby-debug-ide (0.4.5) 2) when I run "rails server --debugger" I get: c:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/resolver.rb:132:in resolve...

Rails 3.0 Mongrel issue

Ok guys the truth is I'm working on porting an application up to justhost.com as I cant afford my own servers yet. Either way I have been receiving this error in the mongrel.log and am getting no help as to what this error means or how to fix it. /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in ...

Accepting emails into a Heroku hosted application

Hey all! ive got a email setup to forward to mx.sendgrid.new (the sendgrid mail server) then with received emails sendgrid passes them to a specified page (as shown in the 2nd image of the tutorial im following) http://nanceskitchen.com/2010/02/21/accept-incoming-emails-into-a-heroku-app-using-sendgrid/#comment-37 SO what CODE is insi...

Rails: Delete a Has-Many Relationship ONLY

Hey, I have a: has_and_belongs_to_many :friends, :join_table => "friends_peoples". To add a friend I do: @people.followers << @friend which create the relationship and a new person profile. Now I'd like to delete the relationship ONLY and not the person profile. I tried @people.friends.delete(guilty.id) but it deletes the person pro...

Blog for existing Ruby on Rails application

I have an existing rails application/website that I want to add a blog to. I would like to access it by www.existingapplication.com/blog so I was thinking it would need to be some kind of plugin or engine or something. Does something like this exist? The main thing is that it can't be a standalone rails application, it has to be an ad...

Rails select_date form name

As much as I love rails, I've always hated dealing with dates in an html form...especially when the date isn't an object's property. The select_date helper is nice, but it always generates this: <select name="date[year]" id="date_year"> <select name="date[month]" id="date_month"> <select name="date[day]" id="date_day"> And I can't fi...

Ruby on Rails Dynamic Models

I'm working on an application where the end user defines what columns a database table should have based off column names in an Excel spreadsheet that gets uploaded or just by manually defining them before uploading the spreadsheet. Is this something that AR and MySQL could handle or am I better off using mongodb or couchdb? In the tr...

rails find(:all) do... how does it work?

I'm on rails 2.3.5 puts params[:_search] users = User.find(:all) do if params[:_search] == "true" puts "TESTTTTTTTTTTTTTT" pseudo =~ "%#{params[:pseudo]}%" if params[:pseudo].present? firstname =~ "%#{params[:firstname]}%" if params[:firstname].present? lastname =~ "%#{params[:lastname]}%" if para...

Running phusion with nginx, how will pointing to public folder make this work?

Confused here, how will pointing nginx to the /public folder make a RoR application run? The public folder doesn't have any of the .rb files in it? Does it somehow access the folders below? ...

What is the !! and a few other things in Ruby?

I have been digging through some ruby gem code and i came across these and not sure what they means def success? !!@success end def failure? !@success end cattr_accessor :test_response and lastly this chunk of code class_inheritable_accessor :attributes self.attributes = [] def self.attribute(name, options={}) top_level_name...