I am using Rails 3.0.1, Bundler 1.0.3 and Ruby 1.9.2p0 (2010-08-18 revision 29036). Everything was fine and fast until I started adding Devise & Omniauth. From that on everything involving initializing Bundler (calling Bundler.require as in application.rb) took ages (by means of 30-50 seconds which is a lot for e.g. calling 'rake routes'...
Sorry if the question is obvious, I am only starting to work with Rails.
I have a following code in several controller methods now:
respond_to do |format|
if @project.save
format.html { redirect_to(edit_project_url(@project), :notice => '#{user.name} added to #{role}.') }
format.js
else
format.html { rend...
Hello,
I have the following:
@books.each do |book|
... stuff
end
I'm curious to learn. How can I update the above to do something like loop through @books but not more than 6 times, MAX/ceiling of 6?
Thanks
...
So one week ago I started to move my old app written in Rails 2.3.5 to new 3.0. Unfortunately, I found out that some of the views are loading surprisingly slow.
Example:
Rails 2.3.5 Ruby 1.8.7 -> WEBrick: Completed in 297ms (View: 143, DB: 40)
Rails 3.0.0 Ruby 1.8.7 -> WEBrick: Completed in 3081ms (View: 261, ActiveRecord: 108)
Rails ...
I installed Devise today and everything works fine so far. The only thing devise seems not to offer is a 'registration#show' action, which displays the user information (instead of the registration edit page). I tried to override the registrations-controller, but get the error: 'Unknown action-AbstractController::ActionNotFound' for all ...
I have a gem to which I'd like to do few changes.
I have it defined in my Gemfile as follows:
gem 'mongo_mapper", :git => "git://github.com/jnunemaker/mongomapper", :branch => "rails3"
I was not able to find it in /usr/local/ruby/lib/ruby/gems/1.9.1/gems.
...
In order to avoid hot-linking, S3 bandwidth leeching, etc I would like to make my bucket private and serve the files through a Rails app. Concept in general sounds very easy, but I am not entirely sure which approach would be the best for the situation.
I am using paperclip for general asset management. Is there any build-in way to achi...
I'm very confused on this restful authentication plugin on rails 3. I tried to install the plugin using the following command. It tells me it's already installed, then I tried to use the --force to reinstall this plugin it tells me that the plugin not found
So if the plugin is already installed why do I get error Could not find generat...
Hi all
Hopefully this is just a quicky....
I have a form to edit a product and each product belongs to a category.
In the form_for(@product) I can populate a select box for the categories in a couple of ways:
<%= f.select :category_id, Category.find(:all).collect{|c| [c.category, c.id]}, :prompt => "Pick a Category" %>
or:
<%= f.se...
session[:user => user, :user_id => [user.id, user.salt]]
For some reason, that never worked for me.
Thoughts on how I can achieve the following code in one line:
session[:user] = user
session[:user_id] = [user.id, user.salt]
...
How to use SOAP web service in Rails3?
I tried datanoise-actionwebservice but doesn't work for me. I heard that rails3 has integrated SOAP support, but I don't find nothing about this on the internet. Can you help me?
...
Hey!
I am creating a rails3 application and I want to create a class that handles string formatting, so I made a class called FormatUtilites.rb in the lib directory but whenever I try calling it from somewhere else in my app I get this error:
ActionView::Template::Error (uninitialized constant ActionView::CompiledTemplates::FormatUtil...
class Category < ActiveRecord::Base
acts_as_tree :order=>position
scope :top, where("parent_id is null")
scope :sub, where("parent_id is not null")
before_create:add_uuid
private
def add_uuid
require 'uuid'
self.uuid=UUID.new.generate
end
end
i used a uuid plugin into rails
i have test the code UUID.new...
Hello, I'm creating a observer model: booklogger_observer.rb
The observer model looks a little something like this:
class BookLoggerObserver < ActiveRecord::Observer
observe :book
def after_create(record)
@logitem = ......app specific stuff
@logitem = ......
@logitem = ......
assign_meta(@logitem)
@logitem...
I tried to install it as below but it throws error :-
"sudo gem install sqlite3-ruby"
Building native extensions. This could take a while...
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files ...
I just ran
$gem upgrade rails
It seemed to go smoothly (updated 23 gems, no errors, etc...)
when i run
$rails -v
It tells me I have 2.3.5. What gives?
...
I've just upgraded to Rails 3, using the instructions from this railscast. When I try to start the server, this is what happens:
$ rails s
script/rails:6:in `require': no such file to load -- rails/commands (LoadError)
from script/rails:6:in `<main>'
I can't find this exact error using Google. Anyone know what is causing this? Tha...
Foo.group(:start_at).count(:id)
How I can group this by date ? the "start_at" column is an datetime column
...
Hello.
I'm using Rails 3 / factory_girl_rails / Rspec 2 and Ruby 1.8
I've defined my factories this way:
Factory.define :user do |u|
u.name 'Some guy'
u.sequence(:email) {|n| "person#{n}@example.com" }
u.password 'password'
end
Factory.define :password_reset_user, :parent => :user do |user|
user.password_reset_key '...
I have a nested resource, setup like this:
resources :chickens do
resources :eggs
end
The views for the EggsController are under views/eggs, but:
describe "eggs/index.html.erb" do
gives a "No route matches {:action => "create", :controller => "eggs"} error on calling render. How do I get RSpec to find the correct (nested) ...