ruby-on-rails3

Rails 3 - Dealing with Model Inheritance? Books > Authors, not Books & Authors

Hello. I have two models: Books and Authors. Books has_many Authors Authors belongs_to Books Problem is right now this loads in my app: /books /authors I don't want users to be able to look at /authors The behavior I want is users to first select a Book and get all kinds of great book detail... Then the user can click "Show me all th...

jQuery .AJAX is not moving on to the SUCCESS and alerting

See anything wrong with this? $.ajax({ url: '/nav/side', data: "urlpath=" + urlpath, success: function(data) { alert('Load was performed.'); } }); For some reason it's not alerting.. I'm using rails 3... Thanks ...

Nested Resourced, Books > Authors... Creating Records for Authors...

Hello, I have the following rails 3 nested resource: resources :books do resources :authors end My authors table has ID | name | book_id Given I'm at the URL /books/312/authors/new How do I structure the controller, so that I create a new Author assigned to a book @author = Book.author.create.(params[:author]) What should the ...

heroku deployment testing

I have an app I've been upgrading to Rails 3, I've been hosting it on heroku for the past 6 months (rails 2.3.8 currently) but am unclear how to test my Rails 3 branch before I proceed. The most i could find about the subject in their docs was that I could do something like this: $ heroku create --stack bamboo-ree-1.8.7 --remote trybam...

Rails multiple has_one associations

I have multiple models with created_by and modified_by columns. This is what I have for a Deal Model. class Deal has_one :user , :foreign_key => 'created_by' has_one :user , :foreign_key => 'modified_by' end class User belongs_to :created_by , :class_name => 'Deal' , :foreign_key => 'created_by' belongs_to :modified_by , :class_name =>...

An app forum for rails 3

Hi I'm looking for a forum app for rails 3. All the forums is for rails2. Any suggestions? Thanks ...

bash_completion for Rails 3

Is there any bash_completion script ready for Rails 3? ...

Give, Nested Resourced, Books > Authors… How to Link to the Author SHOW page

Hello, I have the following rails 3 nested models: resources :books do resources :authors end I now have a view here: /books/131/authors/ And I want to each record to link to something like: /books/131/authors/3333 <% @authors.each do |author| %> <%= link_to 'author.name', book_author_path(@book, @author) %> <% end %> but tha...

Rails, getting a part of a URL /modelstuff/31 --- how to get 31?

I'm interested in learning in Rails 3, how to grab the URL with something like params[:urlpath] and then indexing it with / so if I had a url like examples: /books/1 /books/1/authors/3 /books/1/authors/3/chapters /books/1/authors/3/chapters/33 I could always obtain 1 something like params[:urlpath] index[2] I need this to populat...

Problem pushing a master to heroku

I'm follow an online railstutorial Everything is ok but when trying to push the master directory to heroku. When it come to this: Installing rails3_serve_static_assets... done -----> Gemfile detected, running Bundler version 1.0.0 install everything but sqlite3, here it output: Installing sqlite3 (0.1.1) /usr/ruby1.8.7/lib/ruby/site_r...

How to allow custom flash keys in a redirect_to call in Rails 3

In Rails 3, you can pass has attributes directly to redirect_to to set the flash. For example: redirect_to root_path, :notice => "Something was successful!" However, this only works with the :alert and :notice keys; if you want to use custom keys, you have to use a more verbose version: redirect_to root_path, :flash => { :error => "S...

db:auto:migrate in Rails 3

I have just updated my app from Rails 2.3.5 to Rails 3. One of the plugins I liked most was Auto Migrations by Dizzy: http://www.dizzy.co.uk/ruby_on_rails/contents/auto-migrations This allowed me to make changes in the database simply by altering the schema then running db:auto:migrate. This plugin does not seem to be working in Rails ...

How to cache HAML files in /tmp directory?

I'm having an issue with HAML where it is attempting to write to a read-only filesystem (on a Heroku-deployed app). I can only write to /tmp and /log. How can I configure HAML to write files to the /tmp directory? Thanks! Edit: Output of actual error Started GET "/" for <ip> at Sun Oct 03 13:19:42 -0700 2010 Processing by Welcom...

Regex to Match an URL with a HASH

Hello, I'm using the Rails 3 nav plugin simple-navigation: http://github.com/andi/simple-navigation In the configuration file you can setup a regex to determine what element gets the ".selected" class. Example: primary.item :projects, 'Projects', project_path, :class => "sideNav-main", :highlights_on => /\/projects/ The above work...

Considering upgrading to Rails 3

I'm thinking of upgrading a current Rails 2.3.8 / Ruby 1.8.6 app to Rails 3 / Ruby 1.8.7. Seeing that Rails 3 has been out for a month now, are there big issues that developers have ran into upgrading 2.x app besides the expected some gems aren't supported yet, deprecation warnings / methods, etc? Are there major stability issues with Ra...

How to alter columns with ActiveRecord in Rails?

I'm new to ActiveRecord. I realized that I had forgotten to add a default value for a column in one of my tables. I want to create a migration to fix this, but I can't figure out how. Is there an alter_column method that you can call during migrations? If not, how can I do it? EDIT: I just tried using change_column, but this causes an e...

Rails 3 - Using link_to but adding a # for AJAX Deep Linking

Hello, Currently my links in Rails are using link_to as follows: <%= link_to project.name, project %> Which makes something like: <a href="/projects/1">Project 1</a> I'm working to implement an AJAX app with deep linking so instead of the above, I want the output to be (with a #): <a href="#/projects/1">Project 1</a> Is there a way...

'no driver for sqlite3 found' in fresh rails install on windows 7 machine

My Gem file looks like this: source 'http://rubygems.org' gem 'rails', '3.0.0' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' #gem 'sqlite3-ruby', :require => 'sqlite3' gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3' group :development do gem 'rspec-rails', '2.0.0.beta.18' end group :tes...

Routing problem in ActiveScaffold with Rails 3.0

I'm trying out ActiveScaffold with Rails 3.0, still trying to get it to work at all. I'm getting an error No route matches {:active_scaffold=>true, :action=>"show_search", :controller=>"locations"} when I browse to http://localhost:3000/locations. I have "resources :locations, :active_scaffold => true" in my routes.rb, but I don't kno...

Accessing a URL Param Project.find(params[:project_id]) in the application_helper.rb

Hello, I'm trying to build a helper called def current_project @current_project = Project.find(params[:project_id]) end I want this so that in the navigation plugin I'm using I can use current_project to populate the navigation. Problem I'm having is while params[:project_id] is available in the navigation config (navigation.rb...