I have a seed script called load.rb in the db directory of an application. I just got this app from a client so not sure how to run this script. I get a name error on all of the Model.create(...) statements. I guess this is because the Rails environment is not loaded.
There is no indication that this load script was run via a rake ta...
How do I make TextMate use the Rails bundle by default? On some files it's enabled, and on others (including models) it's not, and I wish it would just assume that every .rb file is a Ruby on Rails file unless I tell it otherwise.
Is there a project-level or global setting for this?
...
I would like to alter the processing of thumbnails in paperclip by having imagemagick apply a drop shadow to all the thumbnails. What I'm stuck on is the actual imagemagick command that would pull this little miracle off. Everything I've tried returns an incorrectly scaled drop shadow without the original image.
def transformation_com...
I have an :xxx image processor, and I have two styles in the model :big and :thumb.
How I can process with :xxx only the :thumb image leaving the :big image untouched ?
...
Say I want to store some variable in my controller. I want to initialize it in one action, increment it in another, and read it in yet another. Just declaring this variable with @foo doesn't work because @foo dies after the action that created it is rendered.
I do not want this variable to be stored in a model.
Is there a way to pre...
I have a many-to-many relationship set up through a join model. Essentially, I allow people to express interests in activities.
class Activity < ActiveRecord::Base
has_many :personal_interests
has_many :people, :through => :personal_interests
end
class Person < ActiveRecord::Base
has_many :personal_interests
has_many :activitie...
I'm slightly confused about a polymorphic association I've got. I need an Article model to have a header image, and many images, but I want to have a single Image model. To make matters even more confusing, the Image model is polymorphic (to allow other resources to have many images).
I'm using this association in my Article model:
cla...
I'm running the latest Rails 2-3-stable branch (currently 2.3.3).
I'm using JQuery to post an AJAX request to my 'create' action, in which I have the following block:
respond_to do |format|
format.js
end
I have created create.js.erb and to test this action, I've added the following single line:
alert('hello');
The request correc...
I have this in my database
<input type="text" value="<%= account["accountname"] %>"/>
this will show the value of accountname in the field that I desire it too.
However, if I want the user to change that value to something else it doesn't allow that to occur.
If I put this in place of the above code sample
<%= text_field_tag :acco...
I have a model class that has, among other things:
class Group < ActiveRecord::Base
has_many :subscriptions
has_many :users, :through => :subscriptions
has_many :admins, :through => :subscriptions, :source => :user, :conditions => "subscriptions.role = #{ROLES[:admin]}"
has_many :subscribers, :through => :subscriptions, :source...
Hey,
I have a ajax method that renderes a @collection of users. This code is from the users partial. Now what I need to do is wrap a ul tag around the 3 li tags for every third object. How do I do this with HAML? I can't just add the %ul tag to "when 1" - because HAML closes the tag when that object has been rendered.
-case user_count...
I have two models, TreeNode and User. Each user has_one TreeNode, which is the root of the tree.
class TreeNode
acts_as_tree
belongs_to :user
end
class User
has_one :tree_node
end
I would like to have this setup so that rails will make the association so that I can do something like
User.first.tree
instead of
User.first.t...
I'm not exactly sure where the problem I'm running into is occurring. When I run the deploy task the rake thinking_sphinx:configure works fine, but then when it tries to index it this error occurs:
ERROR: index 'board_core': column 6 has no name.
ERROR: index 'board_delta': column 6 has no name.
...and so on for all of my indexes and ...
I have an index action in rails that can handle quite a few params eg:
params[:first_name] # can be nil or first_name
params[:age] # can be nil or age
params[:country] # can be nil or country
When finding users I would like to AND all the conditions that are not nil. This gives me 8 permutations of the find conditions.
H...
Given a Rails application on the server, what is the best charting/graphing solution for displaying dynamic, database driven charts/graph on a web page such as those available in Google Analytics.
An optimal solution would include components that can speak JSON back-and-forth with the Rails application via AJAX.
Thanks!
...
Hi All,
Is there a quality way to update the text inside a "link_to_remote" and leave the link functional? Basically I have two links:
<%= link_to_remote "(#{building.charts.size} Charts)",{:url => {:action => "update_chart_matrix", :chartable_type => "building",:chartable_id => building.id, :title => building.name},
:update => 'ch...
I am having problems with my ruby on rails app. I have two models - 'patient' and 'address', a patient has one address, and an address belongs to a patient.
Patient.rb
class Patient < ActiveRecord::Base
has_many :charge_slips
has_one :address
validates_presence_of :last_name
validates_presence_of :first_name
validates_presen...
In rails, I want to separate model, view and control into two parts and put them on two different servers. Can I achieve this by REST? How should I do?
...
Hi all,
I'd like to run a rake task in my controller. Is there any way to do this?
Thanks,
Sophy,
...
Hello, I am considering about what is the difference between JRuby on Rails and the original Ruby on Rails for my product?
How does it difference in development activity, deployment, support between its original, or scalability?
I have read many article. They said JRuby is the same function like Ruby. Does it mean we can use Ruby gems ...