ruby-on-rails

How do I convert a Twitter API Pull into an Array in Ruby On Rails?

I am trying to create a stream that includes Twitter data + my app's but I'm having trouble with this because Twitter's data isn't properly coming out as an array. This is my code: answers = Answer.find(:all, :conditions => {:user_id => @user_id }, :limit => 20) tweets = Twitter::Search.new(params[:username]) @feed = (answers + tweets)...

Ruby on Rails: Submitting an array in a form

I have a model that has an attribute that is an Array. What's the proper way for me to populate that attribute from a form submission? I know having a form input with a field whose name includes brackets creates a hash from the input. Should I just be taking that and stepping through it in the controller to massage it into an array? Ex...

Would it be crazy to use a (serialized) array instead of a join table to link two database tables?

I'm using Ruby on Rails to develop a web application. I have a wiki article system as part of my project. As part of the wiki, articles can be linked to authors, and those links also need to be tracked by the revision system. Authors is an attribute of the Article as a whole, and not related to who enters particular Revision, and is a ...

Installing gems tries to load the gems in my custom rake tasks before installing it

I'm developing an application using rails 2.3.5, gitorious and deploy with vlad, the OS is Linux Mint 9 Isadora. vlad:setup and vlad:update are ok. But when I vlad:migrate and have the same error than if I ssh on the server and try a rake gems:install rake aborted! no such file to load -- ya2yaml /var/www/path/to/releases/2010062...

bindings between rails and mysql hosed after restoring to a new iMac

Had to restore from time machine/capsule to a new iMac after my MBP died. Everything but rails (2.3.5) connection to mysql is working. My old socket connection in my database.yml was /opt/local/var/run/mysql5/mysqld.sock To add to the fun, I seem to have multiple installs of mysql. How do I reconnect mysql to rails? How do I locate ...

set Attr_accessor for all instance variables

I have a 20 field database, and would like to set all the variables to be able to be accessed. Is there a way to set attr_accessor to all of the variables, without listing each one i.e. attr_accesor :a, :b, ... etc ...

undefined method for nil:NilClass but the object exists in the console

Showing app/views/posts/_post.html.erb where line #4 raised: undefined method `name' for nil:NilClass Extracted source (around line #4): 1: <p> 2: <b>Post Content:</b> 3: <%=h post.content %> by 4: <%=h post.author.name %> 5: </p> Here is my posts model: class Post < ActiveRecord::Base belongs_to :board belongs_to :author, ...

"Before Save" callback on associations

How do you call the "before_save" callbacks on an association when saving the parent object? For example: class Company < ActiveRecord::Base belongs_to :user before_save Proc.new { ... } # Not called. end class User < ActiveRecord::Base has_one :company before_save Proc.new { ... } # Gets called. end params = { :user => {...

Using ActiveResource POST to create an entry in another Rails application

Hi There are 2 apps App1 and App2 and I am trying to create an entry into the items table of App2 from App1 using ActiveResource I want this to work: new_item = App2::Item.create(:property1 => "foo", :property2 => "bar") This is what I am doing: In App1: module App2 class Item < ActiveResource::Base self.site = "http:/...

Looking for simple poll/survey Rails plugin or gem

I am trying to find a simple poll plugin/gem (the type of single question poll that's usually found in site's sidebar). All plugins that I've found are either too complex (like having their own DSL) or they are out of date (i.e. older than couple years). Does anyone knows a Rails plugin/gem that handles simple polls? ...

JRuby gem problem

Hi, I am trying to run a rails application in Netbeans with JRuby as the underlying Ruby. When I try to run the server, I got an error like this, Missing these required gems: libxml-ruby So I tried installing the libxml-ruby gem, but I cannot install it because its a native version and jruby would not support it. Thats fine. (in...

How to check the documents is uploaded to scribd.com using rails scribd-fu gem?

There are 4 methods in scribd-fu for checking the document status, conversion_processing?, conversion_complete?, conversion_successful?, and conversion_error?. So, how can I know is the document uplaoded to scribd.com successfully? Thanks all. :) ...

What is the "Best Practice" for SOAP servers to implement error notification?

I am developing some SOAP web services using Ruby on Rails and considering how to handle generic failures. These generic errors are applicable to all the methods within the service and include the following :- Missing Request element Missing Authentication element (Custom) Invalid Authentication details I can intercept these errors w...

Rails layout related problem.

I have application.html.erb in app/views/layouts directory. application.html.erb if @condition <%= yield %> end index.html.erb in app/views/item directory <% @value.id %> item_controller.rb def index @value = nil if @condition @value = my_value end respond_to do |format| format.html end end if @condition is...

many nested attribute form_for for single inherit

I have this models class Store < ActiveRecord::Base has_many :person , :class_name =>"person" accepts_nested_attributes_for :person end class Person < ActiveRecord::Base has_many :addresses, :as => :addressable, :dependent => :destroy, :validate => false accepts_nested_attributes_for :addresses ...

Ruby Tmail error: undefined symbol: rb_get_kcode

ruby: symbol lookup error: /usr/local/lib/ruby/gems/1.9.1/gems/tmail-1.2.7.1/ext/tmailscanner/tmail/tmailscanner.so: undefined symbol: rb_get_kcode strange error that crash app. ruby 1.9.1 rails 2.3.8 tmail 1.2.7 ...

how to display more records on searching with Thinking_sphinx with rails

Hi, I have updated my searching fields records with thinking_sphinx gem and I have configured it. It is working fine but the problem, It is only displaying 20 records which is default. How to change those thing to make more records visible on view.. ...

Using lightbox_me for forms in rails 3

Hello I would like to use the jquery lightbox : lightbox_me in order to manager my new and edit forms. My forms are working in simple AJAX, but I don't know how to do to include them into the lightbox and make it works? Any advise? Thanks in advance. Fabien ...

Is it possible to determine whether an ActiveRecord attribute has been set, other than to the default?

We have an ActiveRecord model whose columns have some default values. It also has a validation condition such that, if the 'profile' property is set to a different value, then the default values are invalid. What I'd like is to be able to determine whether the attributes have been set since they were set to the default so that I can re...

Ruby on Rails: Cucumber: Test that only passes when ran by itsself?

I'm also using Capybara. I have a bunch of test cases.. and two of them only pass when I run the tests separate from rake cucumber:all or cucumber features I have my testing set up so that the DB only clears as one of the above commands starts, rather than finishes, so that I can play with everything after the tests have ran. What's re...