ruby-on-rails

Of the changes to Rails between 1.x and 2.x which ones have actually affected your work in Rails?

I'm doing a course on Rails that focuses on version 1.1.6 so I'm trying to figure out which of the numerous changes between 1.x and 2.x are the most critical to be aware of for practical use. At the moment I don't need to know all the little nitty gritty changes - just the big ones. ...

Using rails or ASP.NET for website on Windows

I need to create a site that interact with some windows applications. Currently this is done through direct calls so I would like these to run on the webserver. This means that the site will have to run on a Windows based system. I have been doing some ruby lately and am very keen on using rails for the site, but have at the same time s...

Can you only send out email from the username specified in the ActionMailer smtp_settings?

Hello, in my ActionMailer config file I have this: ActionMailer::Base.delivery_method = :smtp ActionMailer::Base.smtp_settings = { :address => "mail.foo.com", :port => 25, :domain => "foo.com", :authentication => :email, :user_name => "[email protected]", :password => "foo1234567" } With this configuration can I only send o...

A definitive list of IDE's for Ruby on Rails

In no particular order: Aptana RadRails Netbeans Textmate VIM (Rails Plugin) RubyMine EMACS + Rinari E-Texteditor Komodo RDT (Ruby Eclipse) Ruby in Steel (Visual Studio plugin) Please add more and I will update periodically. ...

Sqlite driver not found on windows

I am facing the same problem as the below one. Does any one has any solutions? http://stackoverflow.com/questions/515639/ruby-cannot-find-sqlite3-driver-on-windows/520342 I installed Ruby 1.9.1, then rails.Then, I installed sqlite3-ruby but thats broken.So, I deleted the directory, and installed sqlite3-ruby for win version 1.2.3.But, ge...

How do I get the name of a Ruby class?

How can I get the class name from an ActiveRecord object? I have: result = User.find(1) I tried: result.class # => User(id: integer, name: string ...) result.to_s # => #<User:0x3d07cdc>" I need only the class name, in a string (User in this case). Is there a method for that? I know this is pretty basic, but I searched both rails' ...

New RadRails project in Eclipse with SQL Server

I'm trying to get into Rails development and am using Aptana Studio (RadRails) as a plugin to Eclipse (WinXP). When I create a new project with the options shown here things go south. I get this error right away: Mongrel's set as the default server and it's complaining about starting because of a missing log file. Sure enough, n...

Problems with routing a Rails form_for

I have a form that I am using to try and update a field on a 'thing', However, I'm getting massive problems that is probably down to something stupid. My code is as follows: <% form_for :thing, :url => { :action => "update" } do |f| %> <%= f.collection_select :status_id, Thing.statuses, :first, :last %> <%= f.submit 'Submit' %>...

In Rails, how can you output the name of the action from inside the view?

If I render the update action from inside the create action, is there a way for the "update" view (i.e. update.html.erb) to know which action rendered it. I want the update view to print out the action name "create" when the create action renders it and print out the word "update" when the update action renders it. The problem is render ...

Provide feedback to view from controller in ruby on rails

I am using multiple file field in a view to upload multiple files. I would like to update the user of progress while uploading. I tried using something like this def create params[:upload_data].each do |file| unless (file =="" or file== nil) @photo = Photo.create({:approved => false, :user_id => @current_user.id}) ...

How to create "invite a friend" associations in RoR?

Hi, We're try to add a basic "invite a friend social networking" component to users. We already installed RailsCasts beta-invitation but need to create where the user :has_many friends type relationship upon the friend successfully signing up. Can someone recommend a tutorial and/or plugin as necessary? I have come across this thread...

how to get simple search in rails based on RailsCasts tutorial?

I followed the RailsCasts tutorial to do a simple search with autocomplete, but it doesn't work. :( view/vendors/index: <% form_tag vendors_path, :method => 'get' do %> <%= text_field_with_auto_complete :vendor, :name, {}, {:method => :get, :class => 'textbox'} %> <%= submit_tag "Search", :name => nil...

booleans in rails with sqlite

I am a bit of a noob still with rails, but I am running across something that seems a bit odd. I added a boolean field to a model in the database thusly t.column :admin, :bool, :default => false, :null => false However, the value in the sqlite3 database seems to be either 't' or 'f'. That is fine, but I would still expect user.admin? ...

AR Mailer with changing settings?

Hi we're running ARMailer in one of our projects right now. It's working fine but as different customers are allowed to send confirmation emails via this service we want to offer them the possibility to use their own SMTP settings for that. Is there a way to change ARMailer settings on the fly? Or is there an ARMailer alternative mayb...

rails windows problem

Hello, I just installed ruby on rails on windows. install mysql and created a new project. Then I changed database.yml to use my own mysql server as follow development: adapter: mysql database: mytools username: test password: test when I try to access story controller(http://localhost:3000/stories), error shows "SQLite3::SQLExcepti...

problems with mysql for ruby on rails

Hello, ah...it is not easy to get started ruby on rails to me.. I am trying to use mysql for ruby on rails development. When I execute "gem install mysql", I get following error. error: while generating documentation for mysql-2.8.3-x86-mswin32...message: unhandled special: special: type=17...bla bla... how do I install mysql for ru...

What is the best way to add inflections in a Rails plugin?

I'm writing a plugin that needs some inflections of it's own. Using rails 2.3 wich has the engines embeeded, where I should place my inflections? ...

Highlight tab in menu

Hi all, I have a menu which is a ul Home | Calendar | Settings I want to highlight (via a css class) the selected tab in the menu. Some links (Home and Calendar) also have subselections Home | *Calendar* | Settings ------------------------- Add event | Edit event Ofcourse when edit event is selected, Calendar should still be hi...

Nokogiri: Sort Array of IDs according to order in HTML document.

I have an unsorted Array holding the following IDs: @un_array = ['bar', 'para-3', 'para-2', 'para-7'] Is there a smart way of using Nokogiri (or plain Javascript) to sort the array according to the order of the IDs in the example HTML document below? require 'rubygems' require 'nokogiri' value = Nokogiri::HTML.parse(<<-HTML_END) ...

How do I find the source file for a rake task?

I know you can view all possible rake tasks by typing rake -T But I need to know what exactly a task does. From the output, how can I find a source file that actually has the task? For example, I'm trying to find the source for the db:schema:dump task. ...