Hi,
I'm kind of new at ruby on rails, and I've read many tutorials about this, but I still can't figure out what's wrong.
I already set up the environment.rb with the following lines at the bottom:
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.default_content_type = "text/html"
ActionMailer::Base.smtp_settings = {
...
How could I implement this? I think my solution is very dirty, and I would like to do it better. I think there is an easy way to do this in Ruby, but I can't remember. I want to use it with Rails, so if Rails provides something similar that's ok, too. usage should be like this:
fruits = ['banana', 'strawberry', 'kiwi', 'orange', 'grapef...
How to expire a directory in Rails?
I have a blog where /posts/ lists all the posts. Controller posts, action index. Pretty standard stuff.
Posts are paginated in groups of 10 using will_paginate.
The pages are being cached like this:
/posts/
/posts/index/2
/posts/index/3
/posts/index/4
...
/posts/index/134
/posts/index/135
...
e...
I'm fairly familiar with using Paperclip in my Rails apps and having attachments stored on S3.
However, on my next project I'd like each user to use their own S3 account. Assuming I'm using restful_authentication or authlogic, what would be the best way to store each user's credentials and have Paperclip use them?
...
I posted a similar question to this not too long ago in regards to formatting a MySQL query using a block and got very good responses, but they were very specific to the problem at hand. This time around, I'm dealing with getting the .sum()s of rows in a table. Here's what I've got now:
def balance
balance = 0
items.each do |item|
...
If I have a model (Choice) belonging to a polymorphic association (Suggestion), is it possible to create the associated Suggestion in a form for the Choice?
Essentially, what I'm trying to do is allow a user to create a "Choice" in a poll, with potential suggestions being predefined Venues, Cities, or Districts, but also to allow an op...
I want to run some Find statements that only show results from the current two week period of a company - it's the pay period for the company. In other words, not necessarily just the last two weeks of records. A quick search looks like I am not going to be able to use a built-in Time method like Time.now.beginning_of_quarter or Time.n...
In a Rail model, when a record gets added/updated, is the timestamp given per the clock on the rails server or the database server?
...
I've been googling this for awhile. The most relevant post seems to be this:
http://www.ruby-forum.com/topic/200151
I've updated gem to 1.3.5 and installed (from local) the rubygems-update-1.3.5.gem and then ran gem update --system. The update gem said it installed successfully and the gem update --system command returns with 'Nothing ...
I'm newly switched over to the mac. I installed Passenger today. I installed the Passender preferences pane tool which required RubyCocoa. Now script/console won't run. The error message is:
no such file to load -- rubygems
Prior to installing the passenger-related files this seems to have worked fine.
Any ideas?
James
...
I've got the following relationships in my model:
class Show < ActiveRecord::Base
has_many :service_shows
has_many :services, :through => :service_shows
end
class Service < ActiveRecord::Base
has_many :service_shows
has_many :shows, :through => :service_shows
end
class ServiceShow < ActiveRecord::Base
belongs_to :show
belo...
Is it possible to apply strftime formatting to the value of a text input field using a Rails text_field helper?
In the form I use for creating or editing a record, I have a text input field which is populated by a variant of the calendardateselect javascript. I click the text field and a little calendar pops up. After I select year, mont...
I am creating a Will_Paginate::Collection object using the following code
@paginatedResults = WillPaginate::Collection.new(1, 5)
@paginatedResults.replace @results[@paginatedResults.offset,
@paginatedResults.per_page]
but when I try to render the pagination using
<%= will_paginate @paginatedResults...
I'm trying to run my site off the lazy idea of not having user registrations.
Anyway, I want a user to be able to "favorite" items on the site when they click "favorite" off of an "item"
I'm assuming I need to use cookies for this but I don't really know the next step. Could anyone point me in the right direction?
Thanks!
...
I know that there are various ways to use PayPal's API (SOAP, etc), but I don't know anything about them, so in an attempt to broaden my knowledge on the subject, would you please tell me what is being used in this example from railscasts:
1. def paypal_url(return_url)
2. values = {
3. :business => ’seller_1234111...
Let's say you have "lineitems" and you used to define a "make" off of a line_item.
Eventually you realize that a make should probably be on its own model, so you create a Make model.
You then want to remove the make column off of the line_items table but for every line_item with a make you want to find_or_create_by(line_item.make).
Ho...
I have a partial now looking like this:
<%= render(:partial => 'order', :object => Order.new %>
How can I build a few empty LineItem object into the Order.new as in :object => Order.new?
Note that Order has_many :line_items. and LineItem belongs_to :order
And as a commenter mentioned, this might at first seem to violate the MVC desi...
is it possible to use Ajax and make the result as select list with Formtastic?
example:
semantic_form_for @user, :url => profile_path(@profile.id) do |f|
- f.inputs do
- f.input :province, :label => "Province", :as => :select, :collection => ["province-1", "province-2", "province-3"]
- f.input :city, :label => "City", :as => ...
Hi guys,
My website is developed with ruby on rails 2.0.2.
So I want to update this version to 2.3.5.
Unfortunately, the new rails version doesn't include mysql so I install the mysql gem like this tutorial said => install rails
But and it's my problem, when I launch my server (webrick), mysql crash (segmentation fault).
I don't find ...
Hi all,
hope you all doing well.
my question is on ruby technology, we are developing an web based application using rails framework and ruby. I need to know how the routing works (routes.rb), can some one send me a link of sample CRUD application which I can use in my project.
I need also User authentication and authorization framewor...