ruby-on-rails

Changing stylesheet for a partial

I have a Movie class in my Rails app, and I have a "_movie.html.erb" partial that displays the movie's title, its overall rating, and a brief summary. I want a stylesheet to apply to this particular partial, but nothing else in my app. How do I do this? In case it helps, I don't want to do some type of CSS classing on the partial inst...

ApplicationController methods in Rails 2.0.2 not overriding plugin methods using Engines

I am trying to use the Savage Beast 2 plugin in my project. This plugin requires the use of Engines plugin. My project is on Rails 2.0.2. There are some methods in /main_app/vendor/plugins/savage_beast/lib/authentication_system.rb that I mean to override in /main_app/app/controllers/application.rb The views within the plugin (e...

Rails Acts As Commentable, Support for multiple Models? AJAX?

Hello, I'm interested in adding commenting to my Rails 3 app. Acts As Commentable seems to be best choice out there even though it's a little dated? I'd like your input on Can Acts as Commentable support multiple models? Example, I want commenting on items Like Books, Authors, Chapters, etc.. which are all separate pages. Is this poss...

No route matches "/error/HTTP_BAD_GATEWAY.html.var" with {:method=>:get} while uploading 2.2 gb of file

hi all, am running apache(2.2.11) as frontend server to mongrel and using rails application trying to upload 2.2 gb of data but i am getting route matches "/error/HTTP_BAD_GATEWAY.html.var" with {:method=>:get} error anyone has any idea to deal with it, ...

Is this regex sufficent in stripping malicious code from a command line input?

I'm generating text images using imagemagick by passing user inputs via command. I'm concerned that a user could enter something malicious. # regex pattern [^\s\w\.&!?"] # image generation code, in Ruby "convert -quality 100 -background black -fill red -font Times-Bold -size x50 label:'#{@line1}' output.jpg" ...

Moving from MySQL to to Postgres on Rails 3

Aside from removal of some MySQL specific queries, the migration was pretty smooth. The problem now is, that during developement there is a lot more queries to the DB than before. Started GET "/profiles/data" for 127.0.0.1 at Tue Sep 21 10:26:18 +0200 2010 Processing by ProfilesController#data as JSON User Load (24.3ms) SELECT "users...

How reliable is Heroku for a sensitive app?

Hi, How reliable is Heroku for a sensitive app? Can they be trusted for a very important app? Have you used it for a long time? What's your opinion? Thanks ...

rails: add a attribute to a option tag through collection_select

Hello everybody, I have a collection_select: f.collection_select(:selected_id, @subcategories, :id, :cat_transl) which turns into the following tags: <option value="4">Deutsch</option> <option value="5">Chinesisch</option> <option value="6">Spanisch</option> <option value="10">Mathematik</option> What I want is to add a attribute ...

RoR condition for collection

hi, i want to fetch other than collect value i used below code @boys = People.find(:all,:conditions => ["id != ?", @boy_id],:order => "created_at DESC") where, @boy_id is collection of ids but its not fetching the values when i use IN(?) it fetches id in collection... i want to fetch id values which are not in collection.. please ...

Updating existing users with an Authlogic single_access_token

Hi all, I currently use Authlogic in a web-app to handle user authentication, but have now decided to create a limited API which would seem to require the use of a single_access_token. My question is, how can I apply the migration to existing users? I thought using something like add_column :users, :single_access_token, :string User....

How to reference a rackamole config file

Hi, I'm looking to use rackamole in my rails application to email support when something goes wrong. I've installed the gem and added the relevant code to the application controller. In my environment.rb file i've added require 'rackamole' config.middleware.use Rack::Mole, { :app_name => "My Cool App", :user_key => :user_name } I'...

How to encrypt password in smtp_settings while using actionmailer to send Emails in rails app?

This is the SMTP settings I use in my app and i have no idea how to hide(encrypt) the password which is presented in this settings. ActionMailer::Base.smtp_settings = { :tls =>true, :enable_starttls_auto =>true, :address => "smtp.gmail.com", :domain => "gmail.com", :user_name => "somename", #:password => "somepassword", :...

rake db:migrate (+ desert) is giving "undefined method `abstract_class?' for Object:Class"

I'm just trying to run a migration, but I'm getting the following stacktrace (below). I'm using rails 2.3.8 and desert 0.5.4. rake aborted! undefined method `abstract_class?' for Object:Class /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:2242:in `class_of_active_record_descendant' /usr/lib/ruby/gems/1.8/gems/...

ActiveRecord::RecordNotFound (Couldn't find Species without an ID)

I'm trying to learn some Rails but I seem to get stuck on this basic task. In my "Catch" create form I use a dropdown list to connect a catch to a specie. It renders fine: <select id="catch_species_id" name="catch[species_id]"> <option value="">Please >select</option> <option value="1">A species</option> </select> And the ...

Problem installing LibCurl + LibXML + FeedZirra on Windows XP.

Hi, I am rails newbie. I am working on Windows XP. I have this version of ruby. ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-mingw32] I have Rails 2.3.8 installed. I am trying to install feedzirra trying every possible way after watching the Rails Cast 168. First I tried to install using gem install pauldix-feedzirra. I got this ...

Ruby error on non-ruby site

A friends of mine have a shared hosting with many sites hosted. There is ruby on rails, php, xslt/xml sites using mysql or postgress. Today one of the xslt sites displays this error: Passenger error #2 An error occurred while trying to access '..../config/environment.rb': Cannot stat '..../config/environment.rb': Permission denied (13) ...

What is the use of any_instance method in Rails

Hi, I see the following line in one of the test files in rails. It has a method called as any_instance. What is its use? Can someone please explain http = Net::HTTP.new(Person.site.host, Person.site.port) ActiveResource::Connection.any_instance.expects(:http).returns(http) http.expects(:request).returns(ActiveResource::Response.new("")...

HOW do i see content of rails cache

hii all, i would like to know is there any way to view rails cache content?? ...

How do you say in SQL/ActiveRecord, "Find all records where attribute is nil or 'x'"?

I want to find records in ActiveRecord that have an attribute that is either nil or some value: class Model < ActiveRecord::Base end class CreateModels < ActiveRecord::Migration def self.up create_table :models do |t| t.string :some_property end end def self.down drop_table :models end end Model.all(:co...

Optional string in Rails route

I want to add an optional string to an URL. I've tried this: map ":category/p:id(/:title)" => ... The title parameter should be optional, so that the user can insert a optional title or leave it. Sadly this does not work. Any ideas? ...