I would like to stub a web service proxy before all my unit tests. I could call some shared code in each unit test, but I was wondering if there is a better way.
I am using Shoulda.
Thanks
...
I've the following search form with image_submit_tag instead of submit_tag.
Now I get the obvious fail when cucumber runs:
When I fill in "q" with "sachin" # features/step_definitions/web_steps.rb:33
And I press "submit" # features/s...
I'm trying to port over some of my old rails apps to Ruby 1.9 and I keep getting warnings about how "Ruby 1.9 doesn't support Unicode normalization yet." I've tracked it down to this function, but I'm getting about 20 warning messages per request:
rails-2.3.5/activesupport/lib/active_support/inflector.rb
def transliterate(string)
wa...
Hi,
I've 2 models
class Room < ActiveRecord::Base
has_many :people
accepts_nested_attributes_for :people, :reject_if => lambda { |a| a[:person_id].blank? }, :allow_destroy => true
end
class Person < ActiveRecord::Base
belongs_to :room
end
In '/rooms/new' form I've a select tag containing all Person + an 'other' option tag that...
I am wondering if there are any tools available to scan for missing translation keys in a Rails application. eg if I have in my code <%= t :Submit %> but my English translation file does not contain submit: submit, I would like to be able to run a tool that tells me which keys are missing.
...
I think this should be working.
environment.rb
config.gem "hoptoad_notifer", :version => '=2.1.2'
list of installed gems:
$ gem list hoptoad_notifier
*** LOCAL GEMS ***
hoptoad_notifier (2.1.2)
Output of rake:gems
$ rake gems
(in /rails/appdir)
- [R] hoptoad_notifier = 2.1.2
I = Installed
F = Frozen
R = Framework (loaded befo...
I have a model representing a Content item that contains some images. The number of images are fixed as these image references are very specific to the content. For example, the Content model refers to the Image model twice (profile image, and background image). I am trying to avoid a generic has_many, and sticking to multiple has_one's....
In my Rails app I have a multi-level hierarchy of the following kind:
class Vehicle < ActiveRecord::Base end
class RoadVehicle < Vehicle end
class Car < RoadVehicle end
class Buss < RoadVehicle end
Then I have a class referencing the middle level like so:
class Garage < ActiveRecord::Base
has_many :road_vehicles
end
In this simpl...
Hello, I'm new to Cucumber and have been stepping through a railscast by Ryan Bates. http://railscasts.com/episodes/155-beginning-with-cucumber
Unfortunately my scenario is failing where the railscast passes. Specifically it is failing on the step: Then I should see "New Article Created."
I suspect it may have something to do with t...
Hi, thanks for reading this.
I was wondering if I have some simple authentication system in place, like authlogic, how does one use curl to post and put data and, even before talking about posting and putting data, how does one "login" with curl and have the server remember or have curl remember that it is logged in?
if you were to ch...
My question is somewhat complicated, but bear with me. My project has a number of models: User, Program, and Team. Users belong to multiple Programs. Programs have multiple teams, but Teams belong to one program. For each Program a User belongs to, he can belong to multiple Teams. (Think of this in an athletic context where users ar...
I have a record that needs to be validated before doing some action. Am I required to use a "valid?" method if I'm doing it with after_create?
For example, I have in my User model:
def after_create
if valid?
...
end
end
I thought it wasn't necessary to put in the valid method, but my application is telling me otherwise. Any ide...
Hi, I have the below form in my view:
<% form_for(@filedata, :url=>{ :controller=>"filedatas", :action=>"create"}, :multipart => true) do |f| %>
<label>Select File</label> : <%#= f.file_field :file %>
<%= file_field_tag 'uploadedFile' %>
<%= f.submit 'Upload' %>
</p>
<% end %>
I've commented out the f.file_field but I have teste...
I am starting to learn Ruby on Rails. I have an application in mind that I would like to create, but I know I'm going to have to repeat a lot of the things that have already been done a million times (such as user authentication, etc).
I just found out about rails templates. From what I understand, you can use one of these templates to ...
I'm getting started with Ruby on Rails. I think some cheat sheets or reference cards would really help me to get started (specifically, with migrations).
Do you know of any cheat sheets or reference cards that would help me get started?
...
I have a very basic rails app. I am playing around with validation.
Controller
class PagesController < ApplicationController
def new
@user = User.new
end
def edit
@user = User.new(:state => params[:state], :country => params[:country])
@user.save
end
end
Model
class User < ActiveRecord::Base
validates_presen...
I'm using Rinari for Rails development in Emacs. M-x shell will open a new buffer that is correctly PATH'd for my environment (zsh). M-x eshell uses all the incorrect PATH's and I haven't been able to get it to play nicely with anything.
There's a function of Rinari that fires up an instance of a web server for the Rails app I'm editi...
I want users to able to have a profile page at site.com/myNameHere. Rails looks for a controller named "myNameHere." Is it possible to setup routes.rb so that if the controller is not found, "myNameHere" gets sent as a parameter to another controller?
...
I have following:
User model with columns:
id user_id password created_at updated_at
Store model with columns:
id store_id store_name create_ad updated_at
Basically a user can belong to multiple stores. So I would want to get a query like "get all the stores that the user belongs to"
Relationships I'...
What's the standard for applying default values to Rails models from links? Here's the situation:
There is a model in Spree called ProductGroup, which is a collections of settings defining how to find a Product (based on a bunch of property values you set). I want to be able to use this structure for defining common ProductGroups:
E...