ruby-on-rails

Namespace routes aren't working

I have a route which looks something like this: map.namespace :a do |a| a.namespace :b do |b| b.connect ':controller/:action' end end I have a folder app/controllers/a/b which stores different controller files, all exist within a A::B module. This route works well on my local machine but it doesn't work on the server I'm depl...

How to disable rails timezone function?

I just want to insert data record into tables with no timezone support.How to config it? That is to say: the current time is 2010-10-10 15:22:31 in my country/region,I want to the column created_at on the record in the table I just inserted is 2010-10-10 15:22:31. How to config it? ...

How to install rails plugin for vim ???

I have dowloaded the rails.zip file from http://www.vim.org/scripts/script.php?script_id=1567. and have unzipped it to a folder rails. Now to install the plugin to vim. Here's the vim version am using in my ubuntu 9.04 : version 7.2.79. ...

Can I change my map.resources line in routes.rb to change the model name in the URL?

At the moment, I have this line in routes.rb map.resources :usernotes so my paths are /usernotes/new etc But I realise now I want them to be like /notes/new Is there a way to change the line in routes.rb to do this? ...

Running tests for ruby on rails

Hi! I use RubyMine, Windows I wrote test: class PostTest < ActiveSupport::TestCase # Replace this with your real tests. fixtures :posts test "the truth" do @first_posts = posts(:first_posts) assert @first_posts.title == "Ruby on rails" end end But when I run test with rubyMine ( with bottom button I s...

How do you get an ID of a friend? facebooker2. rails.

I am using facebooker2 and mogli gem to interact with facebook open graph. My question is how can I get the ID of my friend so I can post him/her sth on his/her wall? All I can do is post to lets say first friend on my list of friends with the following code: client = current_facebook_client @user = Mogli::User.find("me", client) unless...

Ruby on rails: mock and stub library

Hi! What the best library to use for mock, stub... in ROR application? ...

Update a <div> with form selection

Hello, Again,quite new to Ruby on Rails and Ajax, both. I heard it is supposed to be quite easy to add Ajax stuff into the web sites, and since my forms are somewhat done, I thought I would give it a try. But there are some problems, unfortunately, that I could not really find the fitting documentation. I tried with the only method I f...

Internal messaging in Rails

I'm using this tutorial to get internal messages working on my site: http://www.novawave.net/public/rails_messaging_tutorial.html But, since my latest upgrade to Rails 3, I'm getting this error: NoMethodError in MsgController#sendmsg undefined method `each' for #<String:0xcc8acc0> Application trace: app/models/message.rb:16:in `prep...

no such file to load -- bcrypt_ext (via devise)

I'm using database authentication in devise(current gem) on rails 3 and I get the following error when trying to log in with username/password. no such file to load -- bcrypt_ext This error occurred while loading the following files: bcrypt bcrypt_ext I have previously "Successfully installed bcrypt-ruby-2.1.2" gem. Any ideas...

If I have both Rails 2.3.8 and 3.0.0 (as gems), can I switch between them easily?

On Ubuntu, if Rails 3.0 was installed using sudo gem install rails and then Rails 2.3.8 was installed later: sudo gem install -v 2.3.8 rails Now the system has both Rails 2.3.8 and 3.0.0. But if the following is typed into bash: rails -v Then 3.0.0 will show. Is there a way to switch to using 2.3.8 instead? ...

where does validates method reside in ActiveRecord::Base ?

Hi all, I understand that the documentation to the Rails 3.0.0 validates method is in ActiveModel::Validations::ClassMethods http://www.railsapi.com/doc/rails-v3.0.0/classes/ActiveModel/Validations/ClassMethods.html#M003721 I was wondering then, how a class that inherits from ActiveRecord::Base has the validates method? For example, i...

acts_as_commentable_with_threading - where should the comment.rb reside?

In the plugin or should I move this to my app/models/comments folder ? or Does it even matter? The reason I ask is, the belongs_to :user association does not seem to work when I do this comments_controller: @comment = Comment.build_from(@post, @user.id, comment_body) @comment.save the comment record is created properly in DB In my ...

Exception Notification Missing rack.input

When I am trying to use Exception Notification plugin in my Rails 3 project, I am getting this error. Missing rack.input this error is occurring in /vendor/plugins/exception_notification/lib/exception_notifier/views/exception_notifier/_request.text.erb at line 3 This is the _request.text.erb file 1: * URL : <%= raw @request....

Page Caching in rails 3

Is there is any good page caching plugins available for rails 3. I had used page_cache_fu till now. When I shifted to rails 3 its showing to_prepare method error? ...

Ruby on Rails and RVM: Problem including external gems in my Gemfile (Rails 3)

When I try to include an external gem in my Gemfile (e.g. from github), my RVM doesn't recognize the external gem. It keeps telling me to run "bundle install" even after already doing. For example, when I log into shell and do a "bundle check", I see that all "dependencies are satisfied" but in my browser, Passenger tells me that my gem...

Video Tutorials for Ruby on Rails

I come from a programming background and am familiar with C++, Java etc I am starting out with ROR and I learn by doing things. So reading books is not my thing. I am learning using the Ruby on Rails Video Tutorials from Lynda.com however they are using Ruby2. What are the video resources available for Ruby 3? I like the fast pace book...

Making routes shorter

Hello! I have a model called Forum which has_many Topics. In routes.rb it's set up like this: resources :forums do resources :topics end This naturally gives me URLs that look like this: http://localhost/forums http://localhost/forums/1 http://localhost/forums/1/topics http://localhost/forums/1/topics/2 …you get the picture. I ...

Rails date and time is off on my local machine in created_at

ok this is very strange. My computers clock is correct, but whenever I output a created_at field in the database and format it, the day/time are off my several hours... Is there some Rails 3 localhost type setting? ...

Any links or pointers where I can learn about various data types available in ruby(on rails) ?

Some datatypes which I commonly use are string ,integer while creating models *text_field, text_area and password_field* while creating forms inside views. Data types to use with models are my first priority . ...