I'm using Papeclip(2.3.1.1) with Rails(2.3.5).
In my view I write so:
<%= link_to image_tag(p.attachment.url(:small)), p.attachment.url(:original) %>,
and it becomes into
href="/system/attachments/1/original/1.JPG?1270134617 (for a tag)
src="/system/attachments/1/small/1.JPG?1270134617" (for img tag).
And when I click on the pictu...
Hi,
I want users to enter a comma-delimited list of logins on the form, to be notified by email when a new comment/post is created. I don't want to store this list in the database so I would use a form_tag_helper 'text_area_tag' instead of a form helper text_field. I have an 'after_save' observer which should send an email when the comm...
Suppose I want to be able to view a list of products on my site by going to /product/list. Great. So this uses my 'list' view and outputs some HTML which my web browser will render.
But now suppose I want to provide a REST API to my client where they can get a list of their products. So I suppose I'd have them authenticate with oAuth an...
Currently my controller lets a user submit muliple "links" at a time. It collects them into an array, creates them for that user, but catches any errors for the User to go back and fix. How can I ignore the creation of any links that already exist for that user? I know that I can use validates_uniqueness_of with a scope for that user, ...
Hi
Nested layouts do not work in Rails 3. After I hit this I tried Rails Guides Example on a blank project (both ruby 1.9.1 and 1.8.7). LocalJumpError no block given on line <%= yield :stylesheets %>. If you remove this line you will get the same error on the next yield statement.
Could someone fix(patch) this? It's probably just a matte...
First off here is my model, controller, view:
My model, this is where I have my search code:---------------------------
def self.find_by_lcc(params)
where = []
where << "category = 'Land'"
unless params[:mls].blank?
where << "mls = :mls"
end
unless params[:county].blank?
where << "county = :county"
end
unless params[:acreage_range].b...
Even if I never specify :null => false in my migrations that initially add columns to tables, rails still generates code in schema.rb that specifies the columns as having :null => false. Why is this? If I develop on my box, and then use rake db:schema:load on my production box, I'm going to get very different behavior!
Edit: Even if I d...
A rails app I'm working on features examples of quadratic equations. Obviously, these are all of a common structure: ax^2 + bx + c = 0.
I don't want to store every single example of these. I'd rather generate them from a template. Storing hundreds of possible versions of this structure seems highly wasteful and un-DRY.
On the other h...
Has anyone managed to get HolyGrail (http://github.com/mynyml/holygrail) to work with RSpec. It is currently TestCase centric, but I was hoping for an easy way to extend into RSpec/Rails
...
Is the BigDecimal class broken? It seems like the following should never, ever occur:
Note that a.to_f != a.to_s.to_f
a.class
=> BigDecimal
a.to_f
=> 18658.1072928
a.to_s
=> "10865.81072928"
b.class
=> BigDecimal
b.to_f
=> 10000.0
b.to_s
=> "10000.0"
(...
So I'm using Ubuntu 9.10, trying to setup and deploy my app, but for some reason, whenever I try and boot up thin, it tells me it can't find rails, script/console, however, works fine. Heck, even script/server works fine as long as I don't try and daemonize it, then it just fails without any errors. Any ideas on what the hell is going on...
Hey all,
I am unable to get a highcharts plugin to render a chart in a rails application:
http://github.com/loudpixel/highcharts-rails
I believe it has something to do with the sql queries to the database placed in a ruby array, which the javascript is unable to intepret. This is what I have:
def panels
pass = Student.find_by_sql('SEL...
Is there a way to get a report of how long each test is taking to run on a Ruby on Rails project? I have a a small set of tests, 2 or 3, which take about 50% of the time and I'd like to find out which ones are.
...
In my mental model of authentication, a user should be distinct from the way they log in. So for example, a User could have an associated EmailLogin (with an email/password), or they could have many (or none). Similarly they could have 0..* associated OpenIDLogin credentials.
Are there any existing authentication libraries for Rails whi...
Im getting the errors below despite following the documentation.
In test_helper.rb
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require "authlogic/test_case"
require 'test_help'
require 'shoulda'
require File.dirname(__FILE__) + "/factories"
In my functional test
require 'test_...
I have a Ruby on Rails app that I've recently deployed to a remote server (Ubuntu 9.10, nginx, passenger, ruby-enterprise) and I'm getting the error (works fine locally):
Permission denied - /var/www/project_name/tmp/.ruby_inline/Inline_ImageScience_cdab.c
First, the folder /tmp/.ruby_inline/ is empty - should it be? Is it trying ...
I feel like this might be really simple but I'm just not getting it right, so I have like a settings page in my app and I want each setting to be like a key value store, for example:
+-------------------+--------------------------------+
| setting | value |
+-------------------+------------------------...
I have a User model, a Post model, and an Interest model.
User has_many posts through interests
User has_many interests
Post has_many users through interests
Post has_many interests
Interest belongs to Post
Interest belongs to User
Application_Controller is as follows:
class ApplicationController < ActionController::Base
...
I love using irb to quickly check how my ruby code reacts. Im wondering is there a way to do the same say in Firebug or soem other tool?
...
I'm think something like Facebook apps here. User generated pieces of code that people can write to interact with my app.
I understand how an authenticated API works, but this seems a little more complicated because not only does the APP have to authenticate itself (with a regular api-key) but the USER using the app has to be authentic...