How should I spec this nested build:
#projects_controller.rb
def new
@account.projects.build
end
So far I have something like this:
#projects_controller_spec.rb
describe ProectssController do
describe "GET new" do
let(:account) { mock_model(Account) }
let(:project) { mock_model(Project).as_null_object }
before do
...
Hi.
Everytime I start my Rails applications I get LoadError with the following output.
On Rails 2.3.8:
no such file to load -- sqlite3/sqlite3_native
<internal:lib/rubygems/custom_require>:29:in `require'
On Rails 3.0.0:
no such file to load -- bundler
<internal:lib/rubygems/custom_require>:29:in `require'
I run the application...
Say I have a child model with two parent models:
Event has_many tickets
Person has_many tickets
Ticket belongs_to Event
Ticket belongs_to Person
Routes are mapped so Ticket always nests within Event or Person:
resource :people do
resources :tickets
end
resources :events do
resources :tickets
end
How do I scope my ticket_Cont...
I want to get current user's name. As documentation describes, I should user User.name method. Tried to use it as in the example - didn't work.
Tried this:
val = User.current.name
And this:
user = User.find(User.current.id)
val = user.name
What am I doing wrong?
...
ruby 1.8.7
gem 1.3.7
rails 3.0.0, 3.0.0.rc
when i write rails -v
error message come
Could not find gem 'mysql2 <>=0, runtime>' in any of the gem sources.
Try running 'bundle install'.
when I run bundle install then also it cann't install mysql2
please help me.
...
Example form
<% form_for @search do |f| %>
<ul>
<li>
<%= f.label :item_number_equals, "Item number" %><br />
<%= f.text_field :item_number_equals %>
</li>
<li>
<%= f.label :description_keywords, "Description" %><br />
<%= f.text_field :description_keywords %>
</li>
<li>
<%= f.check_box...
Hi,
I want to call a Rails method from a JavaScript method using AJAX. Please help me.
...
Hi Everyone,
until lately my application was working great with facebook connect.
When you click on the "login with facebook" button the popup shows up, and clicking allow does half it's job:
Facebook connects to my secret controller that I set up in the Post-Authorize Callback URL
but instead of closing the popup and redirecting the us...
Following the http://github.com/binarylogic/authlogic_example how would I change it so that password confirmation is required for everything (such as for the edit user, and password reset pages) except for the registration page?
I'd like the registration page to only require an email, a password and a captcha. I only want password confi...
My app works pretty much perfectly in production – the website part of it, at least. The problem only pops up when I SSH into my VPS and do "rails c RAILS_ENV=production". The console works fine in development mode.
I've had this problem before (or at least one that looks like it) and fixed it by adding "reconnect: true" to database.yml...
validates_presence_of :match,
:message => "for your name and password could not be found. Did you #{link_to "forget your password", help_person_path}?"
That's what I want to do. I can interpolate variables that are set in the model, but using simple Rails code like "link_to" doesn't seem to work. Which is a bummer.
...
I'm trying to get webrat to select a radio button from a list, using cucumber.
I have this scenario:
Scenario: Update an existing article
Given I have an article with title Big Bananas and body text Big yellow bananas are good for you
And I am on the list of articles
When I choose "Big Bananas"
And press "Update article...
SomeController#update (RestClient::ResourceNotFound) "Resource Not Found"
I'm receiving this error (where previously I was not) while trying to enqueue delayed jobs using the autoscale branch of DelayedJob. This does not occur with a none autoscale branch but I'm at a loss to pinpoint what the problem is.
If anyone is experiencing the...
I have had this problem for a while, but now it is getting so bad that every 2-3 pageloads my local server is failing.
activesupport-2.3.5/lib/active_support/core_ext/module/introspection.rb:73: [BUG] gc_sweep(): unknown data type 0x0(0x950f868)
ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32]
This application has requested the ...
I have an order entry-like system where we know most of the time we'll need to use most items in the product catalog. The models are:
class Product < ActiveRecord::Base
hobo_model
fields do
name :string
end
end
class Order < ActiveRecord::Base
hobo_model
fields do
ship_to :text
end
has_many :order_lines
end
class...
I'm using mailman gem for fetching email from pop3 server and send it to Rails application. What should I do to make mailman be as daemon? Please, tell me easiest way to do it.
May be whenever gem can help? Something like:
every :reboot do
command "cd /home/rails/root && ruby bin/mailman_fetcher.rb"
end
...
I'm building a fairly simple recipe site to learn RoR, and I've been following the getting started guide, except that I've exchanged posts for recipes and comments for ingredients.
I got all the way to deleting a comment (ingredient) http://edgeguides.rubyonrails.org/getting_started.html#deleting-comments
now i'm getting an error
und...
Is log4r a good option for proper logging in rails app (date time, severity, notification etc?) or is there something else out there?
...
Hello Everybody,
I'm very new to Rails, so please forgive my lack of understanding. I've installed the latest versions of RubyGems, Ruby, Rails, Rake, and MySQL etc via RubyGems, but I have this problem when starting to make a basic Rails app:
Icarus:temporary atg$ rails new people
... (output omitted) ...
Icarus:temporary atg$ cd ...
Hello, I am finding myself repeating typing many strftime which I defined.
Having watch Ryan Bates's railscasts ep 32/33( I think), I created a custom option for the to_s method as in Time.now.to_s, so that I can do Time.now.to_s(:sw), where :sw is my custom method, to retrieve "23 Sep 2010, 5:00PM" for example.
But the problem is, I ...