ruby-on-rails

Crypted_password is null when using Authlogic to save a user

i'm getting a strange error on my production install when i try and create a new user using AL: ActiveRecord::StatementInvalid: Mysql::Error: Column 'crypted_password' cannot be null: INSERT INTO users especially strange b/c it works as expected on my local box. RUnning Rails 2.3.2 and ruby 1.8.7 on both boxes. user.rb: class User <...

Websites that started using Rails or Django but switched to "enterprise" solutions?

Hi Out of curiosity, I'd like to know if anyone knows of any somewhat large website that started out using Django, Ruby on Rails, or similar frameworks, but later switched to using something more "enterprise-ish" such as .NET or JSP. (I tried searching for this question, but couldn't find any.) Thanks ...

rails i18n date problem

hey! we are currently working on a rails project that uses i18n and we have small problem with the dates: # on my mac "10.06.2008".to_date # produces => Tue, 10 Jun 2008 # on a friends mac and on the production server "10.06.2008".to_date # produces => ..., 06 Oct 2008 As you can see the dates aren't right. We checked everything. T...

Ruby function in onclick event

can we def some ruby function (other than javascript) in onclick event for radio button in rails.. for example <%= radio_button(count, voting.vote_count, :onclick => "if voting.nominees.eql?(selected.nominees) voting.update_attribute('vote_count',voting.vote_count+1 )") can i use like this.. ...

Undefined method when accessing through association and uninitialized constant when trying to destroy with :dependent => :destroy

Hello. I've tried persistently googling this error, but to no avail. I currently have these models app/models/survey.rb class Survey < ActiveRecord::Base belongs_to :user has_attached_file :original, :default_url => "/public/:class/:attachment/:basename.:extension" has_many :sub_surveys, :dependent => :destroy end app/models/su...

Updating attribute based on radio selection

I have a table with question_id , nominees and vote_count in which the values for question_id and nominees are populated from other tables with vote_count as zero. ex: question_id nominees vote_count 1 tamil 0 1 selvi 0 2 aaaa 0 ...

Ruby on Rails : Cannot access an object's attributes in an array

Hello, I am building a site with works and their credits. What I am trying o achieve is to find each work's similar works based on the mutual titles in their credits. I am adding each similar work into an array in a for loop and when I try to access the attributes of these works I get a "nil object when you didn't expect it!" error. I...

Should I write rails tests with the def or test keyword?

This seems like a simple question but I can't find the answer anywhere. I've noticed that in general, tests in a Ruby on Rails app can be written as: test "the truth" do assert true end or def the_truth assert true end It seems newer material writes tests the first way, but I can't seem to find a reason for this. ...

ruby on rails undefined method for array

I have a user who owns many phones I have a a phone which has many call summaries therefore my user has many call summaries Now to the code that I have: class User < ActiveRecord::Base has_many :phones has_many :call_summaries, :through => :phones end class Phone < ActiveRecord::Base belongs_to :user has_many :ca...

exposing files from a service through a rails application

Hi All, I have a rails application that generates open office files, and I have a service at another location that will convert these open office files to microsoft office files. I'd like to have a controller action that will send the open office file to the converter, then serve the returned microsoft office file to the user. how cou...

Newbie: What does jQuery.ajaxSetup 'beforeSend' do?

I'm using this in a Rails app. and I have some code that changes the response type to javascript. jQuery.ajaxSetup({ 'beforeSend': function(xhr) { xhr.setRequestHeader("Accept", "text/javascript") } }) This works fine when submitting a form, but it doesn't seem to be called when submitting the javascript form generated...

Rails Rake MySql Autoincrement Problem w db:fixtures:load

I'm trying to load some Rake Fixtures (rake db:fixtures:load) into a MySql database and I'm seeing some weird behaviour with AutoIncrement values. Normally this goes up by 1 for each insert which allows me to define/create tests. (BTW - normal create/insert from script works correctly). However when I load from fixtures the id field is ...

Parsing JSON Payload in Rails When Using Custom MIME Type

A Rails application with a RESTful interface needs to accept POST data using a custom MIME type based on 'application/json'. Let's call that MIME type 'application/vnd.com.example.Foo+json'. Registering the custom MIME type in Rails using Mime::Type.register works fine in that the application recognizes the MIME type given in the "Accep...

Private method call exception for ActionView

I have a functional test suite failing in a Rails 2.2.2 application. The exception thrown, and the associated lines are below: ActionView::TemplateError: Attempt to call private method On line #55 of app/views/wine/view.html.erb 53: <% for activity in @activities %> 54: 55: <% if activity.context == 'ItemComment' ...

Unable to run ruby on rails app?

I am unable to run ruby on rails application. I setup the database and loaded database schema. When I run: ruby script/server -e production It says: => Booting Mongrel => Rails 2.3.2 application starting on http://0.0.0.0:3000 => Call with -d to detach => Crtl-C to shutdown server and it just stays there. If I go to the directory w...

A way to synchronize data between an external device and a database?

Hello, In the application I am designing, I have to communicate with a device and store a history of data readings in a database. The device is essentially a sensor that spits out numbers via the serial port. The user end of the application is a RubyOnRails interface that allows the user to view this data and configure the device. I a...

Using acts_as_state_machine transition methods without saving

I want to be able to utilize the acts_as_state_machine transition methods which are auto-generated (e.g. event!).. but I don't want it to save right away. I'm updating the state as part of another set of operations, and so I don't want to be doing double saves. Is there any way to trigger these event methods without a save right afterwa...

Passing objects from Rails RJS to a javascript function call without quoting the values?

In a Ruby on Rails project I need to have a JavaScript function executed at the end of an Ajax call. My problem is that the values being passed into the JavaScript function being called with page.call are being wrapped up in quotes. Not too much of a problem if you're passing in strings but one of the values is a string representation of...

Would Ruby on Rails be appropriate for this Foreign Language project?

I'm a Spanish professor & computer groupie. About 15 years ago, I authored in HyperCard a series of verb conjugation programs that are now completely out of date with respect to System OS X. I would like to redo these programs myself because I had a lot of fun doing them last time (mostly I coded while my son played in Leaps and Bounds...

Can't connect to AWS in Rails? What should I do to debug?

I have implemented paperclip in rails exactly as a variety of tutorials recommend. Upon trying to upload a photo I consistently get the following: AWS::S3::NoConnectionEstablished usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.6.2/lib/aws/s3/connection.rb:213:in `connection' /usr/local/lib/ruby/gems/1.8/gems/aws-s3-0.6.2/lib/aws/s3/bas...