I've been reading up about HAML/SASS lately and I'm not quite sure why any one would not want to use it. It seems to be very easy to switch, makes things cleaner and more efficient.
Update:
What about using one or the other? Most of the complaints (the few complaints there are) I hear seem to be about HAML, would there be any probl...
I have the following named scope on
class RentableItem < ActiveRecord::Base
named_scope :available_at, lambda{ |starts_at, ends_at| {
:select => "t.*",
:from => "(SELECT ri.*, COALESCE(c1.start_date, '#{starts_at}') AS EarliestAvailable,
COALESCE(c2.end_date, '#{ends_at}') AS LatestAvailabl...
I am trying to send an email to multiple users. I have a model that sends @users, which has all of the users I am going to be mailing... now when in the User_mailer I am having trouble figuring out how to tell the mail_out process to send to each of the users (set each recipient the user.email). To summarize, I want to set a cron job to ...
Here's my controller:
class MyController < ApplicationController
include MyHelper
def index
get_list_from_params do |list|
@list = list
respond_to do |format|
format.html
format.xml { render :xml => @list }
format.json { render :json => @list }
end
end
end
end
...the helper tha...
I'm doing my first deployment of a Rails app and using capistrano. The installation aborts with the following error:
*** [err :: plantality.com] RubyGem version error: will_paginate(2.2.2 not ~> 2.3.11)
but I've already vendored 2.3.11 to vendor/gems and have the following in my environment.rb (which google tells me is the correct thi...
this is what I want to do.
a href="javascript:sayHello('an nyung')"> click here /a
this code is in a server side.
and I wanna to call this link from a client side by using ruby.
is there any way to do this?
...
I have the following wrapper method for link_to:
def link_to_with_current(text, link, condition, *args)
current_class = condition ? 'current' : nil
link_to text, link, :class => current_class, *args
end
When called with this sample:
link_to_with_current 'My Link', '/mylink.html', true, :id => 'mylink'
The following link is gene...
I have two classes that I would like to specify as follows:
class Club < ActiveRecord::Base
belongs_to :president, :class_name => "Person", :foreign_key => "president_id"
belongs_to :vice_president,
:class_name => "Person",
:foreign_key => "vice_president_id"
end
class Person < ActiveRecord::Base
has_on...
Within my Rails application, I'd like to generate requests that behave identically to "genuine" HTTP requests.
For a somewhat contrived example, suppose I were creating a system that could batch incoming HTTP requests for later processing. The interface for it would be something like:
Create a new batch resource via the usual CRUD met...
I'm creating rails application where it allow users to add geo-location data for restaurants, shops, etc to a map( Google map) and querying them.
First I started with http://geoapi.com, as there is a feature for creating our own entities and querying them. But still the service doesn't support well for my country. So, I deiced to crea...
Does anyone know any good gems that can be used to create tables for Ruby on Rails apps. I am looking for something that has built in sorting, AJAX searches, etc.
...
Hello all. I'm relatively new to Ruby on Rails so please don't mind my newbie level!
I have following models:
class Paintingdescription < ActiveRecord::Base
belongs_to :paintings
belongs_to :languages
end
class Paintingtitle < ActiveRecord::Base
belongs_to :paintings
belongs_to :languages
end
class Painting < ActiveRecord::B...
My product model contains some items
Product.first
=> #<Product id: 10, name: "Blue jeans" >
I'm now importing some product parameters from another dataset, but there are inconsistencies in the spelling of the names. For instance, in the other dataset, Blue jeans could be spelled Blue Jeans.
I wanted to Product.find_or_create_by_na...
Hello,
I want to import address book of users from their gmail/hotmail/yahoo and aol address books. I am looking for a gem/plugin in rails which can help me do this. Any help is appreciated.
Thanks.
...
What's the simplest way in Ruby-on-Rails to create several simple hidden fields with known values and the same name in a number of non-model forms (form_remote_tag in my case, but I'm guessing that isn't relevant)?
By "simple hidden field", I mean one where the name is just a single string (field_name) rather than part of an array (fie...
Has anyone implemented an after_commit hook in Rails ? I am not looking for model based after commits on update/create/etc, I want to be able to dynamically define a block that will be executed only if the current (top-most) transaction passes:
def remove_file
current_transaction.after_commit do
FileUtils.rm(file_path)
end
end
...
I have old HTML code with html and css..
<form action="login" method="post">
<div class="field">
<label for="username">Username</label>
<input type="text" class="text" id="username" name="username" value="just click login !"/>
</div>
<span class="fright">
<button class="button" type="submit"><strong>Log In</strong></button>
</spa...
Hi everyone,
I'm looking for a way to upload images that were created in my flex app to rails. I've tried to use paperclip, but it don't seem to work.
I've got this tutorial here: http://blog.alexonrails.net/?p=218
The problem is, that they are using a FileReference to browse for files on the clients computer. They call the .upload(.....
hi...how do i go about uploading a rails app that works locally (on MAMP) to a live server?
thanks
...
I've got a problem testing the following controller code:
def publish
if @article.publish
flash[:notice] = "Article '#{@article.title}' was published."
else
# This is not tested
flash[:error] = "Error publishing article."
end
redirect_to :action => :index
end
Where the function publish looks like that:
def publish...