ruby-on-rails

Rails - Conditions Include Multiple Items In An Array

p = Person.find_by_id(1, :include => :bags, :conditions => ['bag.id in (?), [3,4]) I would like to know how I could make sure this query will only be valid if both 'items.id' '3' & '4' are present rather than '3' or/and '4'. Thanks ...

How do i provide chunked data Transfer in IE(Internet Explorer)

Hi all, I am Running a rails application and uploading some large file (more than 2 GB) am able to do it from google chorme but when i try to do it from IE or mozia am gettind page does not exit and some times IE restart .Someone advised me to enable chunked transfer support in IE... I would like to ...

How to install Redmine on Fedora 11 linux?

I would like to install REDMine on my LINUX LAMP. First i need to install ROR. http://www.redmine.org Provide steps if anybdoy has done installation ...

NoMethodError in Pages#home

I'm working through the railtutorial.org online book for rails 3. I've made it through most of chapter 11, where we add the ability to submit a micropost. After adding the appropriate code, I'm unable to render the page. The following is the error returned: > NoMethodError in Pages#home Showing c:/rails_projects/sample_app/app...

How do I attach a rendered .pdf to an email in Rails?

My application creates a .pdf file when it is rendered by passing it to the URL (for example, domain.com/letter/2.pdf) It doesn't get saved anywhere. How can I make that actual pdf an attachment in an outbound email. Here is my mailer: def campaign_email(contact,email) subject email.subject recipients contact.email f...

Add a class to a selectbox in Rails 3. Please help!

Hello! I cannot figure out how to add a class to this select box in Rails 3. <%= select(:item, :item_type, [['Phone', 1], ['Email', 2], ['Website', 3], ['Address', 4], ['Occupation', 5]]) %> Is there anyone that knows how to do it? Please help! ...

Well built rails code for download

Hi, I want to get into rails by examining well built code where can i find typical open source rails project that i can download and learn from ? i'm interested in facebook connect integration (facebooker), tag clouds, searching in my website I'm not looking not tutorials or screen casts Thanks! ...

How can you set up website.com instead of www.website.com?

I just got a new .CO domain name and I'm curious how to make it accessible without the www. I understand that these two are not necessarily the same thing, but how does one go about securing/arranging both? I've tried googling this but it's hard to successfully google this when your major keywords are 'www' and... not www. =) ...

instant rails phpmyadmin access denied

//edit: I don't know what happened, but I decided to delete the whole instant rails folders, and do everything from scratch, and it worked.. but thanks anyway Hi, I just set up a project using instant rails 2.0, but I can not acces the PHPMYADMIN ( Access denied for user 'root'@'localhost' (using password: NO) ) I did not add any da...

Can't install Rmagick and Imagemagick on Windows 7.

Hi there, when I run gem install rmagick-2.13.1.gem from the directory in which rmagick-2.13.1.gem is I get an Error saying that it failed to build gem native extension, below which it says c:/Ruby192/bin/ruby.exe extconf.rb checking for Ruby version >= 1.8.5 ... yes Unable to get Imagemagick version ***extconf.rb failed*** Could not c...

What's the best open source Rails Facebooker project to learn from?

Hi, I'm creating social network app that integrates with Facebook connect with full facebook integration. I'm looking for an open source Facebooker or facebooker2 project that i can look at the code and learn from. Thanks ...

Declarative_authorization doesn't seem to load?

I'm running bundler with rails 2.3.4. I'm trying to get declarative_authorization to work (I added it to my Gemfile). The error I'm getting is undefined local variable or method 'filter_resource_access'. I'm guessing this means that declarative_authorization isn't loading? Since I'm using bundler I don't have a config.gem line for it...

Use compiled system MySql gem in production

With Rails 2.8 I am using a system gem compiled on a Solaris server, used as production. Rails 3 uses bundler and when I deploy with Capistrano and execute bundle install, bundler is not capable to install that gem. MySql gem must be compiled from source as I documented here: http://riccardotacconi.blogspot.com/2009/10/how-to-install-mys...

Ruby 1.8.7 - Ruby 1.9.2 and Rails 3.0.0 'Encoding' Model Name Conflict

I have a Rails 3.0.0 application that has a model named 'Encoding' and is currently running on 1.8.7 fine. I'm trying to upgrade to 1.9.2, but the name 'Encoding' is conflicting with that version of Ruby. I tried creating a new project, and when running rails g model encoding with 1.9.2 it complains giving: The name 'Encoding' is e...

Paginate in rails

Hi, I'm new to rails and I want to know about paginate method in rails. How can I do pagination in rails. Thanks ...

Not Null in "count" or "find" function in rails

I'm trying to find the not null elements in a database @genus_counts = Table.count(:all, :conditions=> {:col1 => params[:gm], :col2 => nil}, :without => {:col3 => nil}) It's not recognising "without" function. I am in doubt to apply it as array value. @genus_counts = Table.count(:all, :conditions=> {:col1 => params[:gm], :col3 != nil...

Regular Expression problem in erb Rails

Dear All, I need to apply a regular expression in html.erb <% taxon_name.strains.each do |strain| %> <% taxon_name.strain_appendices.each_with_index do |strain_appendice, i| %> <% if ((strain_appendice.data_source =~ /LPSN/) && (strain.relevance =~ /^ty(.*)ain$/))%> <% if i == 0 %> <p><%= strain_appendice.appendix %> </p> <% strain.st...

Unexpected line-breaks when sending XML attachments using ActionMailer

My application stores a lot of XML files. A background job periodically sends some of those XML files to a specific mailbox. The mailer code is dead-simple: class MailSender < ActionMailer::Base default :from => AppConfig.mail_from smtp_settings :address => AppConfig.smtp_host, :username => AppConfig.smtp_user...

Passing parameter back to Model to refine Random action

Hi, I'm creating an application that'll display a random picture based upon a defined letter in a word. Images are attached to a Pictures model (containing another "letter" field) using Paperclip, and will be iterated through in an each block. How would I go about passing the letter back from the each block to the model for random sele...

Using "has_many through" I can't update or add new records, also using rails3 with formtastic for forms.

Why can't I add new items to my database using a has_many :through relationship? I am missing something, the form shows up right, but I just can't add anything to my database. I hit enter and nothing happens. I'm running mysql / rails3 / using formtastic. Subscriber.rb (Subscriber model) class Subscriber < ActiveRecord::Base attr_acc...