Hi,
Pretty new to rails. Am doing a simple book store application. We have different subject areas like physics, chem, philosophy, etc...Each subject area has some books under it. The url ending with book/list will list all books irrespective of subject areas. The subject areas also appear in the same page as hyperlink. The url ending w...
I'm working on a website where I have some text which I am using the RedCloth gem to markdown. basically I need to intercept some text before it gets to the gem, and parse the text with a colour code syntax gem. My regex is very poor (and I don't know if I can do this.) I need to select chucks of text and parse them before RedCloth gets ...
Hi,
How can I add a form name to the following line?
<% form_tag({}, :method => :get) do %>
...
I'd appreciate any thoughts/insight any of you might have on this...
I have two domains running the same applications e.g. mysite.com and mysite.org and I have a requirement that when a user logs into mysite.com then he should also be logged into mysite.org. Obviously, I can't set the cookie on another domain but I want to come up with ...
Let's say you have a form that has its own controller. Is there any way to embed this form in different views (governed by other controllers)? As far as I understand partial templates carry only logic in the Ruby code that is inside the template. I am thinking more of a full-blown component where maybe somehow you can call its controller...
Can someone explain "Authorizing Ownership"?
I've been going through the Railscasts' - 7 Security tips, and was wondering how is the "current_user.projects.find" implemented?
# projects_controller.rb
def show
@project = current_user.projects.find(params[:id])
end
Thank you!
...
I'm trying to use jQuery, and everything has been great, until now, when I'm trying to render a partial and append it to a div. Here is how I have it set up:
I have an action that responds to js:
def index
@objects = Object.find(:all)
respond_to do |format|
format.js
end
end
And a template called index.js.erb with some jav...
How can I add span tags to the following link in ruby?
<%= link_to l(:label_demo), {:action => 'test', :class => 'link' %>
...
I finally moved to using a Linux based development server for Rails, via VirtualBox. I'm using a pre-built image that includes Apache and Passenger.
Everything is great, except Apache still tries to serve an older version of css files in development mode. Even restarting the server doesn't work. I've tried clearing the browser cache ...
Hi,
I'm trying to issue a redirect_to in one of my controllers to a fully qualified URL + I want to pass in some parameters
In the controller for site A I do:
redirect_to: "www.siteB.com/my_controller/my_action?my_parameter=123"
Is there a nicer way to do this in rails?
...
We have an asynchronous task that performs a potentially long-running calculation for an object. The result is then cached on the object. To prevent multiple tasks from repeating the same work, we added locking with an atomic SQL update:
UPDATE objects SET locked = 1 WHERE id = 1234 AND locked = 0
The locking is only for the asynchr...
I'm trying to pass an array into a hidden_field.
The following User has 3 roles [2,4,5]
>> u = User.find_by_login("lesa")
=> #<User id: 5, login: "lesa", email: "[email protected]", crypted_password: "0f2776e68f1054a2678ad69a3b28e35ad9f42078", salt: "f02ef9e00d16f1b9f82dfcc488fdf96bf5aab4a8", created_at: "2009-12-29 15:15:51", upd...
I am learning Rails & Ruby right now with the ultimate goal of using these technologies full time. However, my current job is at a windows shop & I am not in a position to influence any decisions on what technologies to use. I have a limited understanding of web development. However, my database skills have improved significantly thanks ...
My host gives me a few choices when it comes to distros. I know I want to run Ubuntu, but What version will give me the best compatibility with a typical rails app and the usual libraries I'd be using with Rails.
I have these available to me:
Ubuntu 8.04.2 LTS (hardy)
Ubuntu 8.10 (intrepid)
Ubuntu 9.04 (jaunty)
Ubuntu 9.10 (karmic)
...
I'm using the rubyist-aasm state machine for handling the different states in my Event object (event initialized, event discussed, event published, etc.). I added guards to prevent state changes when certain conditions aren't met.
This all works fine but it doesn't show any errors when a state change was rejected by the guard. Any idea...
My rails project has this line in /config/environment.rb
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
As we now have 2.3.5 as the most recent upgrade, is there a way to make my environment.rb accept minor version bumps?
(without I have to explic...
I'm happily using attachment_fu to handle file uploads and thumbnail creation. However, for some (but not all!) cases I would like to suppress the creation of thumbnails.
How would I hack attachment_fu to do this?
Specifics: I have a traditional attachment_fu model
class Pic < ActiveRecord::Base
has_attachment :content_type => :ima...
how to configure netbeans for ruby on rails ?
...
Im using prawn to generate a PDF output in a rails app. How do i change the color of the outputted text?
...
Im trying to use prawn to generate a PDF of a log entry, then entries are stored in bbcode ([b]bold[/b] etc...) and is converted to html on display.
Is there any way to display the html in prawn?
...