ruby-on-rails3

Helping Rails Newbies identify version-specific information on web pages

I am trying to help some people getting started programming on rails identify which version that advice found on web pages corresponds to, and am seeking advice and/or guides on how to do it so they don't have to rely on me and/or waste time trying outdated advice. Narrative: I am helping some people get up to speed on rails developmen...

Rails3 renders a js.erb template with a text/html content-type instead of text/javascript

Hi, I'm building a new app with 3.0.0.beta3. I simply try to render a js.erb template to an Ajax request for the following action (in publications_controller.rb): def get_pubmed_data entry = Bio::PubMed.query(params[:pmid])# searches PubMed and get entry @publication = Bio::MEDLINE.new(entry) # creates Bio::MEDLINE object from e...

NoMethodError: undefined method `has_attached_file'

Paperclip produces this error, after checking out the plugin's rails3 branch. My Gemfile has following line: gem 'paperclip', :git => 'http://github.com/thoughtbot/paperclip.git', :branch => 'rails3' And the error message is: NoMethodError: undefined method `has_attached_file' for #<Class:0x2a50530> ...

Help with Associations in Rails 3

Ruby: 1.9.2 Rails: 3.0beta3 I need some help with associations in Rails 3. I have the following models (see excerpts below): School, State, SchoolLocale The schools table has the following fields: id, name, state_id, school_locale_id The states table has the following fields: id, abbr, name The school_locales table ha...

Where is asset_host rails 3?

What happened to asset_host in rails 3? Earlier I can put following code into development.rb and get all assets not present on development: ActionController::Base.asset_host = proc do |source, request| unless File.exist?(File.join(RAILS_ROOT, 'public', source.sub(/\?\d+$/, ''))) 'http://example.com' end end But in rails 3 ther...

How to render partial.js in rails 3

Using rails3 - I have a project with many tasks. I want to use javascript to build the UI for each task. I figured I could display those tasks on the projects show page by rendering a javascript partial for each. I can't get 'tasks/show' to see tasks/show.js.erb Any ideas? In projects/show.html.erb <div id="tasks"> <%= render(:partial...

Which ruby version/build works best with rails 3?

I've been having trouble discerning which version/build of ruby to use with the most recent rails 3 beta. I was using 1.8.7 but over time the server would use too much memory and begin to slow down and eventually not work at all. Which version/build worked best for you? ...

How to know if model is used from Rake ?

Hi In a model, I include a module used by a Rake task. I would like to do this include only for rake and not for Rails. I didn't find any method to know if the model is used by Rails or Rake. I use Rails3.0.beta3. If you have any idea i would be glad to hear them :) Thanks ...

Rails 3 server won't start in cucumber environment

I'm trying to start my rails 3 app in the same environment that cucumber uses because this is necessary for a particular test. When I try to start the server via rails server -e cucumber I get this error: /home/james/rails-projs/fact/config/environments/cucumber.rb:7: undefined local variable or method `config' for main:Object (NameErro...

Is there any good way to implement nested form in Rails 3?

I've been trying to find a decent solution for nested form, but I couldn't find any tutorial or blog on this topic. Please come and rescue. ...

Bundle package everything

Hello all. I want pack not installed gems but also which fetched from repositories, for example: I want pack paperclip which declared in Gemfile: gem 'paperclip', :git => 'git://github.com/thoughtbot/paperclip.git', :branch => 'rails3' Thanks ...

Rails 3 full-text search options (gems, plugins, etc)

I was wondering if there were any suggestions for how to best roll with full text searching in your Rails 3 apps? Thinking Sphinx and acts_as_ferret aren't updated for Rails 3 yet, and even basic activerecord search helpers like Searchlogic also aren't there yet. Any thoughts? Are you using any forked versions of the above gems that ha...

Why do i get a circular reference exception when calling to_json on an ActiveRecord::Relation

In Rails 3 (beta 3 on 1.8.7), when calling to_json on a relation i get a circular reference exception. Converting that relation to an array first, and THEN calling to_json works. Code That fails: Model.where().to_json (Where model is any model in your Rails 3 app) Code that works: Model.where().to_a.to_json This can be reproed on th...

take performance as the only criterion for a smal site, which framework should I choose on a shared hosting?

Dear friends, I'm trying to set up a small full functional website for a small community on a shared hosting. Scientific computing is quite heavy. Scalability is not important. The only criterion is performance. Which framework would you suggest among the following:(or more) from your list) 1)Ruby on Rails 2) Grails 3) asp.net 4) ...

Access Rails 3 Session from Rack?

I was able to do the following in Rails 2.3.5 to access attributes that I set on the session from within my Rails app. Now in Rails 3, env["rack.session"] is nil. How do I do the same thing in Rails 3? class CallbackFilter def initialize(app) @app = app end def call(env) unless env["rack.session"][:oauth_callback_method...

Rails3 and Sass::Plugin::options

When I try to add "Sass::Plugin.options[:style] = :compact" to environment.rb I get "uninitialized constant Sass (NameError)" when I try to start up my server. I have added "gem 'haml', '3.0.0'" to my Gemfile. Anybody ran into this? ...

How Does Rails 3's "data-method='delete'" Degrade Gracefully?

Rails 3 does some cool stuff to make Javascript unobtrusive, so they've done things like this: = link_to "Logout", user_session_path, :method => :delete ..converts to <a href="/logout" data-method="delete" rel="nofollow">Logout</a> But it just occurred to me.. When I turn off javascript the method isn't DELETE anymore, it's GET as ...

Add Shortcut to Nested Route

I'm using nested routes and I want to provide some sort of a shortcut method. (I'm using RoR 3.0) The routes look like this. resources :countries do resources :regions do resources :wineries end end To access a winery route I want to be able to define a function that removes the need to specify a country and region each time....

vestal_versions : problem with column named changes

Hi, I am working with vestal version for 2 months. Everything was fine until this afternoon. I didn't done anything special(or i don't remembered...) but the code works fine on others computers... The problem is that i'm not able to save my model anymore: rails give me this error : ActiveRecord::DangerousAttributeError: changes is de...

Polymorphic models hackery

Hello, Even though I know that, at least to my knowledge, this is not the default way of doing associations with ActiveRecord I'm looking for help in order to implement an "hibernatish" Polymorphic model. For instance, consider the following base model: # Content only has one property named path class Content < ActiveRecord::Base se...