With autospec / cucumber / capybara running my feature tests I get this line even after going green:
(eval):1:in `initialize': can't convert String into Integer (TypeError)
Anyone know what this is? I thought it was me, then heard another dev was seeing it to, and when googling I see it in the screen logs on various issues at the capy...
If a user tries to submit a form or access a service that uses something such as the following underneath the hood:
Model.find(params[:id]) # if model does not exist, throw ActiveRecord::RecordNotFound
If an instance cannot be found, an exception is thrown. Yet I rarely see folks wrap that statement around in a begin/rescue block, eve...
I am little bit stuck with the following problem. I have two models:
class Book < ActiveRecord:Base
has_and_belongs_to_many :tags
end
class Tag < ActiveRecord:Base
has_and_belongs_to_many :books
end
I have a list of specific tags that can but must not be used in the tags table:
tag1, tag2, tag3, tag4, tag5, ...
Each new boo...
I'm currently in the design stage of a reporting system which will create comparison reports of screens for a fleet of ATM's (being developed in Ruby on Rails).
The data collected from each ATM is stored in XML which contain File Name, Date Modified, Size and Check-sum. These files are then compared with a Master file and report on extr...
Rails has a feature where models, controllers, views, libraries, etc. are automatically loaded when they are needed. This is especially helpful in development mode, where they get automatically reloaded as well.
How do I tell Rails to perform automatic loading somewhere it doesn't expect to load files? Say, I create a folder app/addons ...
I tried the following to respond to AJAX and it works (in HAML):
- response.content_type = "application/json"
= render :text => array_data.to_json
but
- response.content_type = "application/json"
= render :json => array_data.to_json
doesn't work. I thought I could use
= render :text => array_data.to_json
instead of th...
In Ruby on Rails, why
render :json => array_data
shows nothing (as seen in Firebug, the GET in the console), but
render :text => array_data.to_json
shows the data array?
This is related to http://stackoverflow.com/questions/3367246/in-ruby-on-rails-how-to-render-json
...
I want a search field to start outputting results once a user statrs typing
Here is what I got so far
<%= observe_field 'keyword', :frequency => 0.5,
:update => 'results',
:loading => "Element.show('spinner')",
:complete => "Element.hide('spinner')",
:url => { :action=> 'search_results' } %>
then in my controller this is what i ...
I thought Ruby on Rails "script/console" can let me do "render :text => 'hello' " but it says render is not defined?
...
So, I'm building quick and dirty search functionality in my first rails app. I'm doing a query and returning a list of objects. e.g.
@articles = Article.find_by_sql("select * from article where title like "%test%" or title like "%foobar%")
So, the articles collection will return a lot of data, some of it matching my search terms bet...
I am using Rails 2.3.5, but when I use (in HAML)
- s = render_to_string :text => "hello"
or render a partial, it says render_to_string is not a defined method? Clearly it is in the API:
http://api.rubyonrails.org/classes/ActionController/Base.html#M000465
Right now I am using this instead:
- s = render :text => "hello"
since it ...
Hello,
I have this find condition pulling from my model that currently looks like this.
@major_set = Interest.find(:all, :conditions => {:id => 1..21})
I'd like to add some more individual ids that I've just added which are like 120...130. I tried to do...
@major_set = Interest.find(:all, :conditions => {:id => 1..21, 120..130})
...
I have a Rails model with various attributes and has_many relationships to other models. In the view I want the user to be able to enter/change values which will change the values in the loaded object and return results calculated from them whenever they make a change. However, I don't want the values to change in the database until th...
Hi
i have:
<a href="/patients/#{@appointment.patient.id}">
<%=h @appointment.patient.f_name %> <%=h @appointment.patient.l_name%>
</a>
but it dose not work due to a syntax error, if i click on the href it goes to http://0.0.0.0:3000/patients/#{@appointment.patient.id}
thanks
...
Hello,
So I need to run a loop in Ruby to pass some strings into SQLite. Basically I have a table that looks like this:
pID Data
1649,1650,1651|Some data
1643,3|some more data
23,4,5,6,7|More data
Now in my SQLite queries, I will sometimes need to pass all the pIDs for a given line through as one whole string, which I ca...
I want to accomplish the same thing Rails has done, to store configurations in rb files that are read by the application:
# routes.rb
MyApp::Application.routes.draw do |map|
root :to => 'firstpage#index'
resources :posts
In rails the methods "root" and "resources" are not defined in the object "main" scope.
That means that these ...
Hi all,
I'm trying to test a fairly large Rails app, which I probably should have been doing all along but never felt entirely comfortable with. Now I'm working on a functional test to see if a user is created successfully. Basically, I'd like to test a few things:
whether the user was saved (i.e., if there's a new record in the DB)
...
I have a simple phone form <%= f.text_field :phone %> right now. :phone is an integer type, so this requires that whatever the user enters into the form must be something like 5551234 instead of the more standard way of 555-1234 How can I allow the user to enter in a USA phone number like their accustomed to? I understand that I can use ...
So Rails doesn't have support for :through associations through a habtm relationship. There are plugins out there that will add this in for Rails 2.x, but I'm using Rails 3 / Edge, and only need the association for one particular model. So I thought I'd stump it out myself with the beauty that is Arel.
First, the models:
class CardSet ...
My observe field doesn't do anything any idea why.
<%= observe_field 'keyword',
:frequency => 0.5,
:update => 'results',
:loading => "Element.show('.spinner')",
:complete => "Element.hide('.spinner')",
:url => { :action=> 'search_results' },
:with => 'keyword' %>
<%= form_remot...