I have Action Mailer setup to render an email using the body attribute of my Email model (in the database). I want to be able to use erb in the body but I can't figure out how to get it to render in the sent email message.
I'm able to get the body as a string with this code
# models/user_mailer.rb
def custom_email(user, email_id)
em...
I added the authlogic_facebook_connect plugin to my project and I'm now having problem running my cucumber test because of a NoMethodError.
undefined method `set_facebook_session' for nil:NilClass (NoMethodError)
In authlogic_facebook_connect/Session.rb the method "authenticating_with_facebook_connect?" is called as some sort of callb...
I have a model
class Car
@@RPCServer = XMLRPC::Client.new("localhost", "/", 8080)
def self.count
@@RPCServer.call("cars.count")
end
end
If server is not running on localhost:8080 I've got a Errno::ECONNREFUSED error.
I want to display an error message to user, how can a handle this error?
...
I have a simple Rails 3.b1 (Ruby 1.9.1) application running on Sqlite3. I have this table:
create_table :time_tests do |t|
t.time :time
end
And I see this behavior:
irb(main):001:0> tt = TimeTest.new
=> #<TimeTest id: nil, time: nil>
irb(main):002:0> tt.time = Time.zone.now
=> Mon, 03 May 2010 20:13:21 UTC +00:00
irb(main):003:0> t...
Hi Everyone,
I have a working Rails application on version 2.3.5 - I am using many to many model relations and have got almost everything working.
What I would like to do is on my new kase page show the most recent kase job ref at the top.
So for example, if I created a new kase with a job ref of "001", if I then went to create a new...
I have a query in my code as below
@sqladdpayment = "INSERT INTO payments (orderid, ttlprodcost, paytype,
paystatus,created_at,updated_at,userid,storeid)
VALUES ('" + session[:ordersid] + "', '" + session[:totalcost] + "', '"
+ "1"+ "', '" + "complete" +"',current_date, current_date, '"+"1"+"','"+ "1"+"')"
Here the table paymen...
I have a repeated line which outputs something like:
Call John Jones in -3 days (status)
I have a helper called show_status(contact,email) which will output whether that particular email had been sent to that particular contact.
If it is "sent," then that entire line should show up as "strike out."
Similarly, if the number of days i...
I decided to try to use the cells plugin from rails:
http://cells.rubyforge.org/community.html
given that I'm new to Ruby and very used to thinking in terms of components. Since I'm developing the app piecemeal and then putting it together piece by piece, it makes sense to think in terms of components.
So, I've been able to get cells ...
If not, is there a gem I can install that lets me do something like:
<%=h link_to "Back", previous_path %>
???
...
Hello all, I've recently begun playing around with MongoDB on Rails through use of the MongoMapper gem. I was wondering if there is some sort of way to have a class/object/collection be both a Document as well as an Embedded Document. I want the same entity to be both included/embedded in other documents, and also be able to exist on i...
This is a bit of an open ended question but we have a problem with a web application that on the final step of completing an order, multiple post requests are being made, sometimes up to 10 and all within a couple of seconds to the page.
Theirs nothing unusual about the page, the user fills out a form which is then validated using the j...
I'd like to create a rails route for editing a user's profile.
Instead of having to use /users/:id/edit, I'd like to have a url like /edit_profile
Is it possible to create a dynamic route that turns /edit_profile into /users/{user's id}/edit, or should I do thing in a controller or?
...
I have a Ruby-on-Rails model:
class Candidate < ActiveRecord::Base
validates_presence_of :application_essay
validate :validate_length_of_application_essay
protected
def validate_length_of_application_essay
return if application_essay.blank? # don't add a second error message if they didn't fill it out
errors.add(:appli...
Hi all,
I try to implement a vote feature in one of my rails projects. I use the following codes (in vote.rjs) to replace the page with a Partial template (_vote.rhtml). But when I click, the vote number can not be updated immediately. I have to refresh the page to see the change.
vote.rjs
page.replace("votes#{@foundphoto.id}", :part...
I am working on a Rails project and the Architect has asked me to investigate bundling CouchDB into to application so that it can be deployed by Capistrano across multiple platforms and managed by Rake.
My expectation was that I could set up the Erlang VM on the various environments and then distribute the CouchDB application with Cap...
Hello, I am building an application that requires a search to go deeper than the initial level. I am using nested scopes to accomplish this and params in the URL
For example, when a user searches for "handbag" it creates a query like the following.
http://localhost:3000/junks?search=handbag&condition=&category=&main_submit=...
I have the following model
class Project < ActiveRecord::Base
has_many :assignments, :conditions => {:deleted_at => nil}
has_many :members, :conditions => {:deleted_at => nil}
accepts_nested_attributes_for :members, :allow_destroy => true
end
class Member < ActiveRecord::Base
belongs_to :project
belongs_to :person
belongs...
I have a model that would look something like:
my_diet = Diet.new
my_diet.food_type_1 = "beef"
my_diet.food_type_1_percentage = 40
my_diet.food_type_2 = "carrots"
my_diet.food_type_2_percentage = 50
my_diet.food_type_3 = "beans"
my_diet.food_type_3_percentage = 5
my_diet.food_type_4 = "chicken"
my_diet.food_type_4_percentage = 5
I nee...
Hi I have a JSON string that looks like this (Usingt Rails and a REST service)
{
person:
{
name:"Pepe",
last:"Smith"
hats:[ { team:"lakers", color:"purple"}, { team:"heats", color:"red" }] } }
I want to be able to able to get that JSON, and save the Person to the database, but I want to s...
Hi,
I have a web service in Rails which among all else should provide file upload functionality to the clients. The clients all use JSON to talk to the webservice. I use the Paperclip plugin for upload management.
The problem is I do not know how to upload a file via JSON. All works in the web formular, but I cannot find information on...