I was trying to switch the layout using Ruby on Rails but I am getting the error: undefined method `layout' for #. I am using Rails 2.3.5 Am I missing an include?
Here is the code:
class HelloController < ApplicationController
def index
layout 'standard'
@message = "Goodbye!"
@count = 3
@bonus = "This is the bonus m...
Hello, I am working on a God script to monitor my Unicorns. I started with GitHub's examples script and have been modifying it to match my server configuration. Once God is running, commands such as god stop unicorn and god restart unicorn work just fine.
However, god start unicorn results in WARN: unicorn start command exited with ...
Good day... I have huge trouble with this and it drives me insane.
My user creation should have some additional data, like this:
<div class="field"><%= label_tag 'species', %>
<%= f.collection_select :species_id, Species.all, :id, :name %></div>
It displays the list of species correctly, yes, but when I do a submit, it is utterly...
When a certain request hits my app I would like to reset the database back to its original state which is backed up in an sqlite3 file. I'd appreciate any help.
The app is hosted on heroku.
...
I have some nested attributes in some models as such:
class Employee < ActiveRecord::Base
has_one :user, :as => :user_role, :dependent => :destroy
accepts_nested_attributes_for :user, :allow_destroy => true
end
class User < ActiveRecord::Base
has_one :person, :as => :person_role, :dependent => :destroy
belongs_to :user_role, :p...
I would like to use a delimited text file (xml/csv etc) as a replacement for a database within Ruby on Rails. Solutions?
(This is a class project requirement, I would much rather use a database if I had the choice.)
I'm fine serializing the data and sending it to the text file myself.
...
I'm trying to install weborb for rails on windows xp, rails 2.3.8
I type in my project directory: ruby script plugin install http://themidnightcoders.net:8089/svn/weborb and i get the error:
ruby: Permission denied -- script (Load Error)
Any ideas out there? Thanks in advance.
...
Hi,
I am trying to set up Vagrant. I am following the guide on the web site and currently have trouble with the Provisioning part of the guide (http://vagrantup.com/docs/getting-started/provisioning.html) I have followed this thing to exactly as it is on the site but I am receiving this error, I am on Mac OSX if it's of any important
e...
I have the following variable definition:
@monday = (Time.now).at_beginning_of_week
I use that in different models, controllers, and views.
Where can I define it (and how should I define it -- @@? ) so I can define it once and use throughout my Rails application?
Should it be in environment.rb? Should it be a @@?
...
Transitioning to bundler with an existing production setup. Naively with a gemfile and setup like:
gem "rails", "2.3.8"
gem "mongrel", git: "http://github.com/dynamix/mongrel.git"
bundle install --path /mnt/app/shared/bundle
Starting with
bundle exec mongrel_rails start --environment=production ...
results in
/mnt/app/shared/bun...
I'm using Mechanize to try and login to http://fedex.com but doing so keeps returning this error:
405 => Net::HTTPMethodNotAllowed
Is that a response from fedex.com? Any ideas how to get around it?
Here's my Mechanize code:
agent = Mechanize.new { |a| a.log = Logger.new("mech.log") }
agent.user_agent_alias = 'Mac Safari'
page = agent...
I would like to give my user's the option to nicely format their comments. I am not really looking for something super fancy, perhaps something lightweight.
There is a ton of information about markup/markdown/texttile etc. Which it the way to go in rails, performance and usability, compatibility with jquery, security being the priority...
Hey all,
I have a database with columns (username, points). I am making a call to return some fields from this database to use in a program. I want to pull:
The top 10 users with the most points
The 5 users above/below the username requesting the rankings
I can pull the top 10 easily enough...
top_users = UserPoints.find(
:all,
...
What can i do you find a case insensitive search
>> Band.find_by_name("metallica")
=> nil
>> Band.find_by_name("Metallica")
=> #<Band id: 3, name: "Metallica", created_at: "2010-10-03 01:17:24", updated_at: "2010-10-03 01:17:24", user_id: "4">
I need to find the record in both cases...any suggestions?
...
Hi, i create a customized devise registration controller and i want to test it with rspec.
I've tried it with a very simple test :
it "creates a new parent" do
Parent.should receive(:new)
post :create
end
but i get this exception:
Failures:
1) Parent::RegistrationsController POST create creates a new parent
Failure/Error:...
I have always written websites that interact with the endusers directly.
Now I want to create a website that lets users create their own websites - from scratch.
Almost like Drupal online, I provide all the unit blocks for them to use to build their own website. They just drag and drop text fields, buttons, (div) containers etc.
I hav...
Company has_many Contacts
Company has_many ContactEmails :through => :contacts
ContactEmail belongs_to Contact
Contact belongs_to Company
Contact has_many ContactEmails
For a specific instance of Company, how can I find all ContactEmails and filter on an attribute, such as date_sent?
I tried Company.ContactEmails but I don't think ...
I just upgraded to Rails 3, and in the last 24 hours I have started to see a new error message popping up in my console:
Errno::ENOMEM: Not enough space - <STDOUT>
from C:/Sanj/Ruby192/lib/ruby/1.9.1/irb.rb:311:in `write'
from C:/Sanj/Ruby192/lib/ruby/1.9.1/irb.rb:311:in `printf'
from C:/Sanj/Ruby192/lib/ruby/1.9.1/irb.rb:311:in `output...
Hey guys! do you know good books for Ruby On Rails With Facebook Platform. please suggest some good books for Ruby On Rails With Facebook Platform!
...
Hi all,
I have a controller called twits controller .. here i have few actions to communicate with the 3rd party API.. it has few actions to authenticate and few actions to get some values with the help of API. Now i have another controller called home and in the index page of this controller i have to call the actions of the twits cont...