ruby-on-rails3

Can't find header files while running bundle install

I am just getting started learning rails. I am building my first app using Ruby on Rails tutorial by Michael Hartl. the book said to use this gem file. source 'http://rubygems.org' gem 'rails', '3.0.0.rc' gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3' group :development do gem 'rspec-rails', '2.0.0.beta.18' end group :test...

How to get rid of devise current password requirement when editing a user?

I've followed the instructions here: http://github.com/plataformatec/devise/wiki/How-to-edit-user-form-without-current-password But it seems to ignore that and still validate and require current password. In fact, I can do whatever I want to app/controllers/registrations_controller.rb including putting tonnes of syntax errors in, and ...

Rails 3 If Statement using a variable from a controller to another controller (ability.rb)

I'm using the Rails Plugin CanCan to handle permissions checks. I have the following in ability.rb: def initialize(user, projectid_viewing) user ||= User.new if projectid_viewing == 8 can :manage, :all else can :read, :all end end The projectid_viewing is being sent from: class ProjectsController < ApplicationController ...

What does this line of Ruby/Rails do?

Can you please walk me through the following line of Ruby/Rails? if user.role? :super_admin To fit my app, I updated it to: if user.role? :admin and that failed, but then I updated it to: if user.role? == 'admin' And it works as intended. Why is that? class Ability include CanCan::Ability def initialize(user) user |...

Rails 3 - IF Statement which doesn't break on NIL

Hello, I have the following if statement: if !projectid_viewing.nil? && !user.role(projectid_viewing).nil? && user.role(projectid_viewing) == 'admin' What I'm trying to do with the above, is not have the if break is projectid_viewing or user.role are nil. projectid_viewing seems to work great but user.role keeps breaking, giving the f...

Rmagic isn't work on Rails3

Hi guys , My Rmagic isn't work ruby -v ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32] rails -v Rails 3.0.0.beta4 irb require rubygems true require rmagick true but , I put the fllow code: gem 'rmagick', :require => false it error: checking for Ruby version >= 1.8.5... yes checking for stdint.h...

JQuery UI dialog display action (Rails 3)

Hi All! Before I start, I'm a beginner at javascript, rails 3 and jQuery so please provide full examples. Here is what i'm trying to do: I have build a rails app with scaffold and changed the default javascript to jQuery in order to make a piechart on the dashboard work. So now I though I could add the jQuery UI and display a dialog b...

Creating Twitter-style routes with Rails3

How can I make Twitter-style routes with Rails3? I've tried the following: match ':username', :controller => "users", :action => "show" match ':username/:controller(/:action(/:id))', :path_prefix => '/:username' EDIT After some more digging through the docs, I did this and it seems to work: scope '/:username' do resources :clubs ...

How to pull plugin from github on heroku?

Gemfile: ... gem 'paperclip', :git => '[email protected]:mdrozdziel/paperclip.git' ... While pushing the app I get the following error. The repo I am linking to is public. Fetching [email protected]:mdrozdziel/paperclip.git Failed to add the host to the list of known hosts (/home/group_home/.ssh/known_hosts). Permission denied (publi...

Ruby on rails hosting

First Hello, and then yearh i know Heroku! But they somehow just dosen't fit my interest, i want to have an email service. Well that's fine with heroku if you insert your credit card informations.. Well ya, no thank you.. So is there an alternative to Heroku? Or is it just imposible? ohh.. by the way, i need crons, email and rails3 su...

Does paperclip work with SimplyStored?

Rails 3.0.0, paperclip 2.3.3, simplystored 0.3.6. I'm using simplystored so i can use couchdb, but i am thinking that simplystored doesn't work with paperclip. I've tried using paperclip as a gem [via bundler] as well as a plugin, and I get the same error regardless: undefined method `has_attached_file' for Video:Class. Any way to g...

Upgrade to Rails3 from Rails3.rc2, and forms are blank...

Using ruby 1.9.2 if I change gem 'rails', '3.0.0.rc2' to gem 'rails', '3.0.0' None of my forms render. My forms all use <%= %> and everything works great in rc2. I don't even get any errors. <%= form_for(@user) do |f| %> Not even this text would render.... Its not even hidden on the page. <% end %> This is my GEMFILE: ...

Remove String from View as save as Cookie

I have a database table with records and I show them on a view page, as below. my question is: If I click "Destroy" Button the corresponding "quote" should not be deleted from Database but it should be removed from view page for my browser only (using cookies?) (not affected for other computers). How can I implement this ? Thank you....

Rails 3 > Rendering views in rake task

Hello there, I'm stuck with a rake task that need to prepare a newsletter for Mailchimp. Using rails 2.x stuff googled I now have this code: desc "Sends newsletter to Mailchimp list" task :send_newsletter => :environment do begin # get render helpers av = ActionView::Base.new(Rails::Application::Configuration.new(Rai...

Rails3 generating and streaming large files

Hello, my Rails3 Application has a certain request which generates a large CSV (20mb+) on the fly, and then prompts the user to download the file (while it is being generated). I've noticed while upgrading from Rails 2.3.x using "render :text => proc" no longer works. I am now working on a solution that will let me keep things working i...

How to use a gem in Rails 3 without referencing it in the Gemfile.

I'm wondering how to make a gem accessible in a Rails 3 app without putting a reference to it in the gemfile. I want to do this with ruby-debug (I'm using ruby-debug19). I use this to debug, but not everybody on my team does and forcing the dependency just so I can use it doesn't seem very diplomatic. Is there another way? If it ends up...

setting production environment in rails 3.0

How is the environment set in Rails 3.0? In Rails 2.x, environment.rb contained a line setting RAILS_ENV to production. It was commented out in the generated file. To force a production environment, uncomment that line. Rails 3.0 contains no such line in environment.rb, and RAILS_ENV is deprecated. Is there something missing, or is ...

Rails 3 ActionDispatch scope options

Do you know a resource which documents all the available options for the ActionDispatch scope method and their usage? I'm quite tired of digging into each merge_X_scope method trying to understand the X option implications. ...

Any easy way to change a Name for a Model?

Hello, I've been building an app recently that has a model Books that is a database table and linked to several models/controllers. I recently learned that instead of Books it needs to be called publications (just an example)... I now want to update the database and all the mentions throughout the app. Is there a simple way to do that i...

Best practice: Ruby/Rails Rspec regex testing

Could you tell me how to test regex-code correctly? I test my user-login attribute with following code: # user.rb class User < ActiveRecord::Base #... validates_format_of :login, :with => /^[a-zA-z0-9_.]{3,18}$/ end # user_spec.rb describe User do before(:each) do @user = Factory.build(:user) @user.save end subject...