Is it possible to set template_root for ActionMailer at runtime? I seem to be able to do this in development mode by using:
ActionMailer::Base.template_root = my_view_path if File.exists (File.join(my_view_path,"test_mailer"))
I'm checking to see if the mailer views directory exists in my special view_path, and using that view_path f...
Exporting some data from mysql to a csv file using FasterCSV. I'd like the columns in the outputted CSV to be in the same order as the select statement in my query.
Example:
rows = Data.find(
:all,
:select=>'name, age, height, weight'
)
headers = rows[0].attributes.keys
FasterCSV.generate do |csv|
csv << headers
rows.each do ...
I am having trouble with paths in ruby on rails
My Routes:
map.resources :companies do |company|
company.resources :customers do |customer|
customer.resources :jobs
end
end
Currently I am creating the paths by hand:
<td><%= link_to 'Show', "/companies/#{params[:company_id]}/users/#{user.id}" %></td>
<td><%= link_to 'Ed...
I have 3 tables
items (columns are: name , type)
history(columns are: date, username, item_id)
user(username, password)
When a user say "ABC" logs in and creates a new item, a history record gets created with the following after_create filter.
How to assign this username ‘ABC’ to the username field in history table through this fil...
i have a rails application on production which is running using mongrel, I can successfully start the mogrel for the application but when i try to access the application on the URL it is not responding... it is just hanging.
This is the mongrel log... but when I hit xxx.xxx.xxx.xx:3001 it is not showing the website but on developent is ...
Hi ,
I have install the Red box plugin by using the following command
script/plugin install svn://rubyforge.org/var/svn/ambroseplugins/redbox .
It installed successfully. and again ran the following command the following location
/myapp/vendor/plugin/redbox/rake update_scripts . It shows me the following output
(in /myapp/vend...
I want to let users write small custom apps (think themes or plugins on Wordpress) and upload/run them on my site.
I'm thinking about using Sinatra apps for this since it would give the users a lot of flexibility, and then running them as middleware inside my rails app.
But I can't figure out the security implications of this. I tried...
I'm using the following config:
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:authentication => :plain,
:enable_starttls_auto => true,
:user_name => "[email protected]",
:password => "sap"
}
When I send the mail, log shows mail is sent. I can see the mail in logger.
But, mail is not deliv...
Possible Duplicate:
Should I start with Ruby or Ruby On Rails?
I've read several other questions about material in order to learn RoR. But my question is can I start learning RoR without Ruby?
It's clear that the other way around is better, but I would rather try this way if it makes sense (somehow). Or learn both in parallel...
As I am learning more about rails, and breaking my design thinking from ASP.Net days, I was considering a scenario this morning but did not know if it was possible to do.
Practitioners have many Treatments through services - and vice versa
In my control Panel I have an area for Practitioners to edit their details (names, contact info e...
HELP!! I need to bundle a gem otherwise a published client's site will stay dead
MacBook-Pros-MacBook-Pro:pn
macbookpro$ sudo ruby script/generate sanitize
Missing the Rails 2.3.5 gem. Please `gem install -v=2.3.5 rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or ...
I'm working on a site that is using Facebook Connect and recently made some changes so that the main pages are cached and if you are not logged in (checked with an ajax call) it loads the Facebook Connect javascript and renders the connect button into the page. This works perfectly everywhere except Internet Explorer 7 and 8. The weird p...
What is the best method to include shipping quotes in my cart?
The basic flow of my site is that
1.) User selects products
2.) User is shown cart
3.) repeat 1 and 2 until User wants to pay
4.) collect user details ( email, address where items will be shipped to )
5.) make payment via active merchant
6.) order is submitted to ...
Hello everyone.
Lets assume we have a User model. And user can plan some activities. The number of types of activities is about 50. All activities have common properties, such as start_time, end_time, user_id, etc. But each of them has some unique properties.
Now we have each activity living in its own table in DB. And thats why we hav...
Hey folks,
I am stuck with something quite simple but really annoying:
I have an xml file with one node, where the content includes line breaks and whitspaces.
Sadly I can't change the xml.
<?xml version="1.0" encoding="utf-8" ?>
<ProductFeed>
ACME Ltd.
Fooproduct
Foo Root :: Bar Category
I get to the nod...
i need to connect to another server we manage and have it's results (in JSON format) processed by rails... how can I do it ?
Thanks!
...
I have a URL to a image which i want to save. I looked into ruby file handling and did not come across anything. Please guide me towards some links or blogs which talk about the same. I need to then use Paperclip to produce a thumbnail of this image to be used in my application.
...
Using Ruby 1.8.6, stubbing a finder method to return an Array does not work when the code under test calls the 'count' method on the result:
User.any_instance.stubs(:friends).returns([user1, user2])
That's because Array.count has only been added in Ruby 1.8.7. Rails also adds a count method dynamically, I believe through the ActiveRec...
I have a Rails model named Xpmodule with a corresponding controller XpmoduleController.
class XpmoduleController < ApplicationController
def index
@xpmodule = Xpmodule.find(params[:module_id])
end
def subscribe
flash[:notice] = "You are now subscribed to #{params[:subscription][:title]}"
redirect_to :action => :index...
I've installed HAML into my project and it is working like a charm - the templates are beeing rendered without a problem. My question is how can I do the rendering on the command line, by using HAML program. That would be super for debugging purposes, meantime while I try to compile HAML file I get the error on first Rails related Ruby c...