Hi,
I have the following class which works fine in my development environment:
module LeadCapturer
class LeadPartArray < DelegateClass(Array)
def <<(part, &block)
super(part) unless ((@arr.select{|p| p.text == part.text}.size > 0) || (part.text.strip.size == 0))
end
def initialize(arr = [])
@arr = arr
...
At the top of environment.rb I could change from 2.3.5 to 2.3.9. Is there anything else I need to do?
...
Hi guys
I just installed rvm and after that i installed ruby1.9.2.
i have a problem with installing gems.
I get the following error when doing:
gem install capistrano
no such file to load -- rubygems
This is how i set it up (its ubuntu):
ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]
gem -v
no such file to load -- ru...
My Scenario:
Sessions are being stored in the database using ActiveRecord::SessionStore
User is on site at 'http://domain.com '
they go to secure checkout at 'https://domain.secure.com' (our app has lots of domains, but want to send everyone through secure checkout on the same domain to save SSL headaches).
We append session_id and a h...
I have a model House that has many boolean attributes, like has_fireplace, has_basement, has_garage, and so on. House has around 30 such boolean attributes. What is the best way to structure this model for efficient database storage and search?
I would like to eventually search for all Houses that have a fireplace and a garage, for ex...
I'm looking at an existing Rails project and trying to see what rake tasks exist by running rake -T. However, when I run that I get:
(in /var/www/project)
rake aborted!
undefined method `mattr_accessor' for Sentry:Module
/var/www/project/Rakefile:10
(See full trace by running task with --trace)
vendor/plugins/sentry/tasks/sentry.rake ...
This is a pure syntactical question. I'm very new to RSpec.
I basically want to write something on the lines of this erroring line :
controller.stub!(:current_user(:update_attributes => false))
Anyone know how to properly write that?
RSpec's default looks like this :
User.stub(:find) { mock_user(:update_attributes => false) }
...
I am using rails 2.3.9 and I want database dump in sql manner. Here is my environment.rb. Notice the last line where I have
config.active_record.schema_format = :sql
Still when I run rake db:schema:dump I see no db/development_structure.sql file.
require File.join(File.dirname(__FILE__), 'boot')
RAILS_GEM_VERSION = '2.3.9' unles...
I have the following models to associate users with roles:
class User < ActiveRecord::Base
has_many :user_role_assignments, :dependent => :destroy
has_many :user_roles, :through => :user_role_assignments
end
class UserRole < ActiveRecord::Base
has_many :user_role_assignments
has_many :users, :through => :user_role_assignments
e...
Hi all,
Have a nested form, the relationship is like so
class Inspection < ActiveRecord::Base
has_many :inspection_components
accepts_nested_attributes_for :inspection_components
class InspectionComponent < ActiveRecord::Base
belongs_to :inspection
I have a custom validate method in Inspection which depends on attributes enter...
I have a method that takes an array of strings and joins them so they do something like this:
>> my_arr
=> ["A", "B", "C"]
>> and_join(my_arr)
=> "A, B, and C"
Which I'd like my mailer to have access to so I can output some information into an email. I can't seem to find a good place to put it and putting it in the application_helper....
The things described in the formal documentation are a bit complicated.
Does it merely add the following line to .bundle/config
BUNDLE_PATH: vendor/bundle
and then perform a bundle install, and that's it? (install will then install all the gems into vendor/bundle)
Then when the application runs, it will look for the gems in this pa...
The instructions of vote-fu say to use ./script/generate, but I believe that is deprecated for Rails 3. I tried to use 'rails generate vote_fu Article', but it says 'Could not find generator vote_fu'. I installed it by adding it to Gemfile and running 'bundle install'.
How do I install this plugin?
...
I have an interesting conundrum. I have a table of programs that has_many install_validations that have many install_validation_reactions (don't ask!). I set the program model to accepts_nested_attributes_for :install_validations, :allow_destroy => true, and the same between the install_validations and install_validation_reactions. Built...
I am using Rails 3 with Cucumber, Capybara and Factory_Girl. I am trying to test following the "Show" link for just one of the rows on an HTML table. I am using the syntax:
And I follow "Show" within "Net 30"
I gives me the following error:
unexpected '30' after 'DESCENDANT_SELECTOR' (Nokogiri::CSS::SyntaxError)
/System/Library/Fra...
I am trying out how Devise works with one of my projects for user authentication. There is a user requirement that their admin should be able to generate a batch of username and user's password from time to time, and then the admin will email the new username and password to his users.
Assume the admin has the knowledge of direct SQL on...
I am using polymorphism to create comments for my Article, Profile, and Photo models. Here is the view for my Article show page:
<div id="comment <%= comment.id %>">
<%= comment.title %>
| <%= link_to "Permalink", polymorphic_path(@commentable, comment), :action => :show %>
| <%= link_to "Reply", polymorphic_path(comment, @comment...
I'm creating a basic message board app with Rails 3. I want posts to be created with UJS/jQuery (submit the post with AJAX and clear the form). I thought this would be simple but I'm getting this error:
Rendered posts/create.js.erb (64.5ms)
Completed in 1771ms
ActionView::Template::Error (undefined local variable or method `posts' fo...
I'm trying to use Ruby's csv module to import the records contained in a csv file to my local table in a Ruby on Rails 3 application.
The table was created through the creation of model Movie.
Here is what I've been executing in console:
require 'csv'
CSV.foreach('public/uploads/VideoTitles2.csv') do |row|
record = Movie.new(
...
I am using link_to_remote and want to pass the following:
<%= link_to_remote "Skip Remote",
:url => url ,
:update => "update-area-#{contact.id}-#{next_todo.id}" %>
Where an example of url would be:
skip_contact_email_url(contact, email)
where contact is an object for model Contact and Email is an object for mode...