ruby-on-rails

How can I determine whether a controller action has rendered (rather than redirected) in Rails 3?

In Rails 2.x I could look at @performed_render (see this question), but this instance variable doesn't seem to exist in Rails 3 ...

Rails Nested Model Forms Error

Hi, I am trying to create a poll, which has many choices. While creating the poll, I am getting the "Poll can't be Blank" Error. Poll gets created when I removed the choices fields from the form Poll.rb class Poll < ActiveRecord::Base belongs_to :profile has_many :choices, :dependent => :destroy accepts_nested_attributes_for ...

authlogic openid: fullname is not a defined simple registration field

I finally got an open id demo app going: rails 2.3.5 authlogic openid When I create a new user in the database, I get the following error: fullname is not a defined simple registration field This is after I authorize the localhost,etc. I don't have fullname anywhere. Any ideas? ...

Why is accepts_nested_attributes_for not working for me? (rails 3)

I'm using formtastic and haml on a Rails 3 application. I'm trying to make a nested form for surveys and questions, but it's just not working for me. I've watched the railscast and on it and everything, but I can't seem to make it work for my application. So right now, I have the following: models class Survey < ActiveRecord::Base at...

Can't convert fixnum to string during rake db:create

Just created a new blog app using rails 3.0 my model is simple: class Post < ActiveRecord::Base has_many :comments end class Comment < ActiveRecord::Base belongs_to :post end I used the commands: rails generate scaffold post title:string body:text etc. to create these files. Now I wanted to generated the db using: rake db:cre...

Aptana vs Netbeans for Ruby Development

Which IDE is more superior for Ruby development? Aptana or Netbeans? Also, is there any IDE to date that is better than the two? ...

Ruby on Rails + EventMachine?

I've heard that you have to use non-blocking code throughout the application to be able to harness true power of EventMachine. Does this mean I can't run Ruby on Rails with EventMachine? ...

Paperclip upload to S3 is failing silently...help!

I have an application which uploads images to an S3 bucket using Paperclip. It's been working fine for months, but suddenly my files are not being uploaded to the S3 bucket. Unfortunately, I've been doing a refactoring in a number of unrelated areas, and it's possible that something I changed broke my upload. I'm using paperclip 2.3.1. ...

Ruby on Rails 3 Routes Question

When clicked on the link below, it takes me to the show screen, instead of deleting the thing. <th><%= link_to 'Destroy', blog, :method => :delete %></th> Controller def destroy @blog = Blog.find(params[:id]) @blog.destroy respond_to do |format| format.html { redirect_to(root_path) } format.xml { hea...

DEPRECATION WARNING in Rails3 for before_create, before_update, before_save, before_destroy

Hello There! I just upgraded my application from Rails 2.3 to 3 and I'm getting some DEPRECATION WARNINGS for my before_create ,update, save, destroy etc. Does anyone know how ot fix the issue? These are my Warnings : DEPRECATION WARNING: Base#before_create has been deprecated, please use Base.before_create :method instead. (called f...

Why am I getting a PG error on heroku when it works fine on my local rails environment?

I am getting the following error: ReportsController#return_search (ActiveRecord::StatementInvalid) "PGError: ERROR: syntax error at or near \"FROM\"\nLINE 5: ...OUNT(contact_postalcards.id) AS postalcard_count, FROM \"cont...\n It works fine locally, but when I push to heroku I get the error: What do I need to change so it will work...

How to update the following lines of rails 3 to include the current_user.user_id

Hello, I have a comments table which includes a column for user_id I have the follow in my comments controller def create @commentable= context_object() @comment = @commentable.comments.build(params[:comment]) . . Problem is this doesn't pass the current_user's user_id. How can I update the above to be something like cu...

Devise authentication gem: How to save the logged in user id?

I'm using the Devise Ruby gem in my Ruby on Rails 3 application. When a logged in user creates one of my models, I want to save their user id as the person who created it. What should I do? ...

Why am I getting a resource not found error when setting workers on heroku?

This is a snippet of my code trying to turn on the number of workers on my heroku instances: heroku = Heroku::Client.new(ENV['HEROKU_USER'], ENV['HEROKU_PASS']) puts "created the client" heroku.set_workers(ENV['HEROKU_APP'], 1) puts "set workers to 1" I stored all the values, HEROKU_USER, HEROKU_PASS, and HEROKU_APP as a heroku config...

Rails 3 - acts_as_nested_set

How do I install "acts_as_nested_set" in my Rails 3 app? I want to be able to add acts_as_nested_set to my model I also want to be able to use ROOT, like this... article.comments.roots.order Ideas? ...

VIM problems with erb files

Whenever I make a open or save and erb file. I get this error. No idea how to fix it Error detected while processing function <SNR>59_UpdateErrors..<SNR>59_CacheErrors..SyntaxCheckers_eruby_GetLocList..SyntasticMake: Line 20: E40: Can't open errorfile ~\AppData\Local\Temp\VIeF751.tmp ...

How can I extend this Ruby ActiveRecord model?

I'm creating this little show scheduler thing. I have the table shows, with title:string and description:text. I want to add days and times to the show (each show can have multiple days, and each day has their OWN times). How might I go about doing this? I was thinking of making a times table. With the columns (show_id, day, and time)....

Autotest with Rspec2 in Rails 3 Can't Find Binaries

I'm trying to get autotest back up and running after moving my project to rails 3. After upgrading to rspec 2.0.0.beta.22, I can't seem to run autotest. I get the following: bundler: command not found: c:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.0.0.beta.22/bin/rspec even though the binary does in fact exist in that location. ...

validation before attribute setters can type cast

Hi I have an object with an attribute called value which is of type big decimal. In the class definition i have validates_numericality_of. However if i: a.value = 'fire' 'fire' ends up getting typecast to the correct type before the validation fires so: a.valid? => true How do get the validation to fire before the typecast? Th...

rails 3 authentication

i'm currently buidling my own blog using rails 3. and use devise gem for authentication. the problem is , i want only one user out here --- the admin user, and prehibits others from signing up, how can I achive that? ...