I'm try learn about email in rails. I'm developing something on localhost. Is it possible to send an email from localhost to say a normal mail account like gmail? Do I have a install a mail server? I've just got a standard rails installation at the moment for development.
...
Is it okay (conceptually) to run for loops in test methods?
I'd like to test a range of parameter values into a controller, to determine if the different inputs return the correct values.
test "logged in user - add something - 0 qty" do
@app = Factory.create(:app)
(0..5).each do |t|
@qty = t
login(:user)
ge...
When I use the attr_accessible to specify which fields from my Model I will expose, is it true for script/console as well? I mean something that I didn't specify as attr_accessible won't be accessible as well through console ?
...
I have learned the language itself as well as html/css/javascript. But with no database knowledge and (a bit)network knowledge. When I read the Pragmatic book on ROR, I found it confusing at the very beginning where they creates a project and setting up databases and models. Should I learn some database(and network knowledge)knowledge fi...
We just ran into this problem the other day all of a sudden. Our Rails app is using will_paginate, and I have it defined as follows in my controller:
# contacts_controller.rb
def index
# ...
@search = @current_user.contacts.search(params[:search])
@contacts = @search.all.paginate({:page => params[:page], :per_page => 20})
end
B...
I am stuck and I guess it is a syntax thing I just don't get:
It's a one(category)_to_many(product) relationship.
In my category model I have the columns pick1, pick2, pick3, pick4, pick5.
Each of those holds the id of a product.
In my category_controller I want to retrieve those in a find:
@productpicks = Product.find(:all, :conditi...
Currently I have this:
class Group < ActiveRecord::Base
delegate :publish_group_creation, :to => 'MyAppModules::Publisher'
after_create :publish_group_creation
end
The thing is that Publisher.publish_group_creation receives 1 argument (the group that's gonna be published)
I tried something like this;
delegate :publish_gr...
Is there a way to do this in Ruby on Rails? Looking through the library i saw a upload_image.rb but it just says #todo...I know this is possible in the other languages (at least i saw in php)
I've searched for awhile, has anybody found a way to do this in RoR? Or is there any documentation? What I want to do is save the image on my ser...
I am trying to convert the twitter post dates into datetime objects but for some reason they are not converting correctly. If I do this:
d = '12:06 AM Oct 15th'
and
d = DateTime.parse(d)
or
Tweet.new :body => "test", :created_at => d
then the date ends up Sun Nov 15 00:06:00 -0500 2009. All dates are converting and containing t...
Uploading a file in PHP results in a map. One of the keys, tmp_name, allows the user to manipulate the file without having to move it around. I'd like to do the same for Ruby on Rails.
I have a form that takes a .csv file. With this, I'm trying to populate a database. However using just the file field from the form, I get a type of Acti...
The following is my application layout file
.container_12.clearfix
= render :partial => 'shared/flashes'
.grid_8
= render :partial => 'shared/search'
= yield
.grid_4
= yield(:sidebar)
It has to grids, one for content and another for sidebar.
Now I'm creating a login page in which I don't want to show my si...
I'm using the Ruby-AWS gem to interact with Amazon. I was testing it out in my controller and it worked fine, but when I moved the code into my Model, it isn't correctly parsing the data back from amazon.
For instance, in my controller
@items[0].medium_image.url = "http://ecx.images-amazon.com/images/I/61YIGdgh86L._SL160_.jpg"
But in...
Lets say I have a wine and beer model/controller along with a wine_review and beer_review model with a has many relationship.
Each table has near identical data types, for example, wine_review and beer_review each has a rating and comment column.
Wine and beer each, have names.
How can I dry up my code so they can both share the same ...
Ok, this one's a little ridiculous, and I'm almost afraid no one will believe me. But here it goes:
I have written a Ruby Rails application that handles content for tons of domains. Now I know this breaks the cardinal rule of Rails, but each domain has all of its information housed in a config file. I know this is probably wrong, but...
Hi,
I am starting a new rails project and is there any rails plug in I can use that will minify my javascript and combine it into 1 file?
I would imagine there might be a rake task for this.
What would be used for this in rails?
Cheers
Paul
...
Hey Guys,
Ive just set up some basic models using scaffold with Rails, i've edited the views so that im taking input from a textfield and a selection box. Here are some code snippets:
form_for(@town) do |f|
f.text_field :name
.
.
f.select :county_id, @counties.map{|c| [c.name, c.id]}
.
.
end
Using the validation method "validates_...
On my OS X development system:
$ ruby --version
ruby 1.8.6 (2007-03-13 patchlevel 0) [universal-darwin8.0]
$ script/console
Loading development environment (Rails 2.3.4)
>> require 'yaml'
=> []
On CentOS 5.3 production system:
$ script/console production
Loading production environment (Rails 2.3.4)
/opt/ruby-enterprise-1.8.7-2009.10...
Hi, I've been trying to trace this error for nearly 2 days now and i can't seem to understand what is going wrong. I'll explain:
I have 2 views (.html.erb format)
ViewA has the following
<% form_tag (:action => 'ViewB') do %>
i have on this page a
select_tag radius
text_field_tag searchQuery (disabled as is filled in already),
text...
Hi everyone. I've been trying to follow this tutorial to let my users upload a bunch of mp3s at once and see the progress.
http://www.railstoolkit.com/posts/uploading-files-directly-to-amazon-s3-using-fancyupload
I implemented it pretty much more or lese exactly, but I removed some of the things from the policy file, so there's only [...
Hi,
I have a controller person with an action searchPerson which takes a name as parameter and redirects to the person details if it founds the person else it renders the searchPerson.html.erb with an error message.
I would like to always have http://localhost/person instead of http://localhost/person/searchPerson
so I added a route
...