ruby-on-rails

Why does my Rails FormHelper (Formtastic) not display booleans correctly?

I am using Formtastic and I have a simple boolean field. In my view, I have <%= f.input :active, :label => "Enabled?", :as => :select, :include_blank => false, :collection => [ ["Yes", true], ["No", false] ] %><br /> It saves to the database just fine. But when it loads, it always shows the first value ("Yes"). What am I mi...

In Rails 3, I'm getting a NoMethodError for the recycle! method during testing

Hello, I've got a functional test that's using fixtures. I also am using fixtures in my Unit tests, but they work without flaw. When running the functional tests, I get a: NoMethodError: undefined method 'recycle!' for #<Response:0x10346be10> /test/functional/responses_controller_test.rb:10:in 'test_testing' My functional tests, at ...

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 ...

Devise and google oauth. (ror3)

Hello, Is it possible to use devise and google oauth together? I have successfully setup facebook in devise, but the following google config doesn't work. Do I have to use oauth2 directly? config.oauth :google, 'anonymous', 'anonymous', :site => 'https://www.google.com', :request_token_path => "/accounts/OAuthGetReque...

jQuery DatePicker ui is failing on IE

IE is giving me an undefined NAN when i try to view the calender... here is my html $("#datepicker").datepicker({ altField: '#outing_suggested_date', minDate: new Date, dateFormat: "yy-mm-dd", defaultDate: new Date("2010-10-07"), setDate: new Date("2010-10-07") }); here is the code i use to generate it $("#datepicker").datepicke...

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...

Javascript validation using activerecord models validators

I have an activerecord model and set of validators to it, But I also have to provide front end validation. Is there a gem or a smart way to use activerecord validators, for instance in jquery validation plugin, instead of writing it by hand? Thanks ...

Routes are not available in RSpec integration test

I am following the examples in the Rails Tutorial website and I'm having issues getting the integration tests to work. Specifically the example at listing 8.20 in section 8.4.2 in the tutorial. At the visit signup_path line of code below I get the following error: "undefined local variable or method `signup_path'" require 'spec_helper'...

page_cache_fu error

I am getting an error when I am starting rails server. undefined method `to_prepare' for Dispatcher:Module (NoMethodError) How to solve this issue ...

Problems installing RMagick-gem in Rails

Hello all I've been plowing through tutorials all day trying to install RMagick, and have gotten pretty far now I reckon, but have stumbled apon an error that I really don't know how to solve, nor get any useful info on. When I try to install the gem, I get this message: Building native extensions. This could take a while... ERROR:...

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 ...

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...

DB pull from heroku fails with Encoding::CompatibilityError

I'm having some problems performing a db:pull from heroku back to my local development enviroment. My setup is MySQL (5.1.50) from a MacPorts install on a local Rails 3/Ruby 1.9.2 environment under Mac OS X Snow Leopard via RVM, and I've successfully performed a heroku db:push to the production site on Heroku many times. However, on a s...

Ruby on Rails: uninitialized constant MysqlCompat::MysqlRes

I tried all the options specified in the link: http://stackoverflow.com/questions/1332207/uninitialized-constant-mysqlcompatmysqlres-using-mms2r-gem but nothing is working. I have an iMac with Snow Leopard installed. I am currently using the mysql gem version 2.7 and I checked that ruby was 64 bit but I am unsure if the mysql gem is 64...

structuring complicated ruby helper routines

I'm working on a fairly complicated app and am trying to figure out how to implement some functionality in terms of rendering data to various formats. In simple terms, the app is taking key value data and rendering it to html, or potentially to other formats. I know key value data sucks but for the app in question it is required. This w...

Issue with jquery tools overlay in Safari

I am trying to present a form inside an overlay. The form is loaded via ajax. This all works fine on firefox 3.x. But on Safari 5.0(5533.16), the overlay shows but does not make an ajax request, rather makes a html request. Here is how I configure it in my js and then on document.ready I call ModalPostForm.init(); pastie - http://pas...

how does Facebook do Deep Linking in say their Photo Gallery pages?

I'm looking for a jQuery Rails deep linking solution... Facebook has a great system as it doesn't have the ugly #s in the URL. Anyone know what they use and / or have any recommendations? ...