ruby-on-rails

rake db:migrate gives a uninitialized class variable @@configuration in Rails error

uninitialized class variable @@configuration in Rails /usr/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:19:in `configuration' /usr/lib/ruby/gems/1.8/gems/thoughtbot-factory_girl-1.2.2/lib/factory_girl.rb:24 /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require' This is the initial part of the envir...

Does RubyMine 2.0 earn it's $99 as a Rails IDE?

I've seen a lot of blogs talk about RubyMine lately, as a best of breed Rails IDE. Currently I am using NetBeans IDE for my Ruby and Rails stuff, but I was wondering if anyone here would personally recommend this IDE, and reasons why I should fork out $99 for it!? ...

In rails, how to obtain the size and type of a file when using "file_field" to upload a file

When I using "file_field" to upload a file: <%= file_field 'upload', 'datafile' %> The file name can be obtained in the controller: params[:upload]['datafile'].original_filename but how can I obtain the size and type of the file? ...

rails app unable to save anything after deployment

Hello today i uploaded my app to server, and after seting it into development mode, and running of course rake tasks (rake db:migrate, and rade db:migrate RAILS_ENV="production" ) and well it just doesn't saves anything. the problem happens when i try to create any new items, it just goest to the listing of models... It's urgent becaus...

Capistrano custom task fails because "Rails requires RubyGems >= 1.3.2"

My custom capistrano task "app:sample" fails with the following error message: mnylen ilmo-on-rails $ cap app:sample * executing `app:sample' * executing "export RAILS_ENV=production; cd /home/mnylen/ilmo-on-rails/current; ruby script/coursegen 10" servers: ["rails.cs.helsinki.fi"] * establishing connection to gateway `melkinpaasi.cs.he...

session key , session id and cookies in rails with swfupload

So I am trying to implement easy_swf_upload but I'm running into an error right away. There's a session key, which is defined like this: session_key = RAILS_GEM_VERSION < "2.3.0" ? ActionController::Base.session[0][:session_key] : ActionController::Base.session_options[:key] Since I have the most recent version of rails I get the sec...

Blog engine for Rails application

I have a Ruby on Rails application, and now I would like to add blog into it. Just a simple blog with basic features and single author. What are the possible solutions? I need to use my authorization system (I used authlogic for my app) Since I am developing for a customer, I need MIT/BSD licence. I would prefer lightweight solution. ...

Model-level authorization in Rails

I want to implement authorization in my Rails application on a model level (not controller), in a similar way that validation on models is done. What is the best way to do this? If it is implemented in the models itself, the main problem is that the models don't have access to the current user. I've seen solutions like: Thread.current[:...

Bluehost internal server error

Hello everyone, When i am creating the setup of my rails application on bluehost,it throw following error:- Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [email protected] and inform them of the time the...

get a list of objects with roles applied in be9 acl9

I think in something like this: def self.obj_list(opts = {:include => [] , :exclude => []}) # Returns an array with all objects with roles applied # +:exclude+:: (array,string) optional object type to exclude from list # +:include+:: (array,string) optional object type to include in list # Example: # Role.obj_list(...

rails, has_one, build_#{association}, accepts_nested_attributes_for

i am trying to develop a wiki with version history. my plan is: each time i edit a wiki content, it should get saved as a new one. for now, i have two models, Wiki, and WikiContent, and following code inside them: class Wiki < ActiveRecord::Base has_many :wiki_contents has_one :current_wiki, :class_name => "WikiContent" accep...

Should I mock my model in rails controller tests?

I am finding holes in my coverage because I have been mocking my models in controller examples. When I remove a model's method upon which a controller depends, I do not get a failure. Coming from TDD in statically typed languages, I would always mock dependencies to the object under test that hit the database to increase speed. I would...

"Lazy loading" of I18n translations in controllers, models etc.

I have this in my controller: class CoursesController < ApplicationController add_crumb I18n.t('courses.breadcrumbs.default'), :courses_path ... end This works fine in my development machine and using WEBrick. However, on the production server, it seems the strings are loaded only once and from the default locale. I have a small...

Rails has_many association and ActiveRecord#clone

shepherd has_many animals. I am trying to clone one of them: dolly=shepherd.animals.build(sheep.clone) I get error: undefined method `stringify_keys!' for #<Sheep:0xb6ce154c> why? what is another way to clone dolly so that she would be associated with a shepherd and have sheep's attributes? ...

User authentication support for Rails, NOT authorization

Which authentication plugin for Rails would you choose? I'm not interested in the permissions, roles and other authorization stuff. I'm interested in the: user model/controllers generation predefined components to support various ways of authentication (HTML form, OpenID) with various back-end (database, LDAP, textfile). I'm looking...

What should table structure look like when adding open auth login to User model

I have a Rails app with a User model. I want to allow users to login with a handful of services. There are 2 ways that I can think to store this in the database but I'm not sure which is best. I should note that I would like users to be able to connect with more than one service and link the accounts. Method 1: For each service, add ...

Rails Model With Aggregrate Data (not backed by a table)

Id like to create a model in rails that does not correlate to a table in the database. Instead the model should dynamically pull aggregrate data about other models. Example: I have a Restaurant model stored in the restaurants table in the DB. Id like to have a RestaurantStats model where i can run a RestaurantStats.find_total_visitors...

please help with rails authlogic

Im trying to follow this tutorial. Its about adding email confirmation after registration... The thing is when I submit the form I get this error NoMethodError in UsersController#create undefined method `deliver_verification_instructions!' for # I looked at the code and indeed there is no such a method on my user model.....

ruby on rails logging out

Hi I am trying to create a view which allows the user to log out So what what I've got is: <%= link_to 'log out', :controller => "client", :action => "logout", :id => session[:id] %> but this gives me this error: No route matches "/client/logout/Lily" with {:method=>:get} Any help please? ...

parameters from one page to another

Hi if I have this on one html.erb page <%= text_field("cars_", "name", :size => "30") %> and def find @car = Car.new(params[:car_]) carsearch = @car.name .... why is the carsearch coming as nil? ...