ruby-on-rails

Ruby on Rails' "rake rails:freeze:gems" or "rake gems:freeze GEM=..." won't freeze files into "vendor" folder?

I was trying to use rake gems:freeze GEM=facebooker2 but then rake won't support it. (using rake 0.8.7, gem 1.3.7, rails 2.3.8, ruby 1.8.7) So looks like the current supported freezing is rake rails:freeze:gems but after I do that, I use hg status | grep facebooker (similar to git status, to see what files are added or modified) ...

Rails Development Productivity - Top Textmate Shortcuts

I want to improve my Rails coding productivity using Textmate. Obviously, shortcuts (whether native to Textmate or to the Mac) can greatly assist. What shortcuts give you the greatest bang for your dev buck? ...

Rails 3 - collection_select - Understanding PROMPT ?

I'm building a form to allow a user to CRUD a project permission. .... <% roles = Role.all %> <%= f.collection_select :role_id, roles, :id, :name, :prompt => true %> Problems with the above, while it renders: If a value matches, it shows that in the dropdown as selected, which is good. Problem, is if a user is set as ADMIN. It's ea...

Paperclip - Default Style per Style? Possible

Hello, I'm using paperclip, and have several styles: :styles => {:large => "300x300>", :medium => "150x150>", :small => "50x50>", :thumb => "30x30>" } The issue is default_stype, only applies to one of the sizes... :default_style => :thumb, :default_url => url here.... How can I set default_stypes for each style type? so if I call:...

What should I do about this "#version_requirements is deprecated" warning

$ ruby -v ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0] $ rails -v Rails 2.3.5 Whenever I run script/server I get this warning: => Booting Mongrel => Rails 2.3.5 application starting on http://0.0.0.0:3000 ./script/../config/../vendor/rails/railties/lib/rails/gem_dependency.rb:119: \ Warning: Gem::Dependency#versi...

Exception generated during rename_column migration

I'm trying to change a column in my sqlite DB via a migration...and I have no idea what I'm doing with RoR so please be gentle! Here's the migration I'm trying to run. class FixContactIdColumn < ActiveRecord::Migration def self.up rename_column :calls, :contact, :contact_id end def self.down end end And here's the except...

How to mock to twitter api using Ruby on Rails?

I'm developing a application that uses the twitter API. I'm currently using rspec with mocha, but I found it to be cumbersome and I cannot reuse the mocking that I create for a give method. Is there a way that you can have for a give call, return something, and for another call return something else? Or it needs to be by each method? ...

will initialize break the layout settings in rails?

In one of the controller, I need a specific layout. I added layout at the beginning. It works well. But if I add an initialize function for some controller-based variable. Rails seems just ignore the layout command. Is anyone have same problem? How can I fix it? class AdminsController < ApplicationController layout "layout_admins"...

Storing configuration variable in ruby on rails

I'm storing configuration variables for different environments in the production.rb and development.rb production.rb ENV['my_variable'] = 'val1' development.rb ENV['my_variable'] = 'val2' Maybe exists another way to store variables for different environments. What is the best way? ...

how to embed a linux bash terminal inside ruby on rails web page?

how to embed a bash prompt/terminal inside ruby on rails web page? how to execute a linux command from the web page, and get the output of the ommand? ...

What's wrong with this ruby on rails migration??

hi all, I am trying to migrate ruby on rails application from one machine to another and when I type Rake db:migrate it gives following error: Mysql::Error: Table 'schema_migrations' already exists: CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB what might be the possible cause..? ...

What is the difference between /it/ and /\Ait\Z/

In Ruby both expressions seem to do similar things: 'it' =~ /^it$/ # 0 'it' =~ /\Ait\Z/ # 0 # but /^it$/ == /\Ait\Z/ # false So I an wondering what is the difference between ^-\A and $-\Z and how to choose which one to use? ...

Passenger does not recognize locally installed gem, works with packed gems

This is a production server. I have Passenger installed and it works properly for the most part. However, I always have to pack the gems with the projects. If I don't, I get this error message: Missing the Rails 2.3.8 gem. Please `gem install -v=2.3.8 rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails v...

stack level too deep in simple captcha plugin for ruby on rails

I am using Simple Captcha plugin in my application. The application was running fine from last two months but recently (last two days) it is giving error "stack level too deep" while saving the user into for "@user.save_with_captcha" line. The error occurs only in Production environment. In development mode, everything works fine. After ...

Script to flag spam or inappropriate content for Rails

Is there any easy-to-install script out there for Rails app? A flag button just like youtube, for user to click when spam or profanity or inappropriate graphic is found in a community post. That flag will notify the admin to review the complained entry so to take necessary action, such as removing the inappropriate content. ...

Is delayed_job work for rails3? which version?

when i run rails g delayed_job,i always get the "Couldn't find generator delayed_job",i already add the "get "delayed_job"" to my gemfile... is there someone tell me why? how can i resolve this problem,thanks... ...

model can be saved,but id is nil in rails3 with oracle-enhanced adapter

ruby 1.9.2 rails 3.0.0 ruby-oci 2.0.4 activerecord-oracle_enhanced-adapter 1.3.1 for example table named users(id:number(38,0), name) user = User.new user.name ='test' user.save! # is successful user.id # got nil user.name # got 'test' and in the database I have sequence named "USERS_SEQ" and worked well(nextval or currentval is r...

How to deploy multiple rails app on a single IP (Apache + Passenger)?

Hi, I want to deploy multiple rails app on a single server. If I had a domain name, I would have easily done that using subdomains as server name in virtual hosts. My problem is that I do not have a domain name. Can I do something like 70.42.89.11/app_1 as one server name and 70.42.89.11/app_2 as another. Or are there any other solu...

render erb from database into view problem please help!

hi all i am saving some erb in my database and rendering it in the view like this: erb = ERB.new(content) render :text => erb.result I am getting errors when trying render erb that has the image_tag in the erb saved in the database. The error is : undefined method `image_tag' for main:Object Anyone help on this ? i also get the...

Validating content of the attributes to not be the same

Hey everybody, I am trying to write a unit testing for a User model in Ruby on Rails. I am using authlogic and need to check that the first_name and last_name of the user model attributes are not the same when the user is registering. This is my user model: class User < ActiveRecord::Base acts_as_authentic do |c| c.login_field= ...