What's the difference between a helper and a partial?
Functionally speaking, both seem like subroutines that generate HTML based on certain parameters. Is the decision to use one or the other in a given circumstance purely aesthetic? ...
Functionally speaking, both seem like subroutines that generate HTML based on certain parameters. Is the decision to use one or the other in a given circumstance purely aesthetic? ...
I'm messing around with rails 2.3 templates and want to be able to use the app name as a variable inside my template, so when I use... rails appname -m path/to/template.rb ...I want to be able to access appname inside template.rb. Anyone know how to do this? Thanks ...
Why (for example web2py) you return data from a controller in a dictionary instead (see Rails) in variables? For example: return dict(sape=4139, guido=4127, jack=4098) instead of (that's the way Rails does it) @var1 = "jello" @var2 = "hihi" Is there any advantage using dictionaries over plain variables (speed-wise/code-wise)? U...
Is there a rails (or other javascript framework) plugin that does the auto suggest like the Related Questions suggestions here in Stack Overflow where after leaving the text field a list of related items shows up? Also is there a name for this UI patterm? ...
When a method being called in the success or enter phases of a state transition throw errors, what is the best way to catch this and ensure that the state reverts back to the previous state. I'm using the AASM gem. ...
I'm trying to delete a plugin I installed for rails (paperclip). But I actually don't have any idea where I can find my local rails installation directory. So where can I find rails and rails plugins in my local file system? I have OS X. Or how can I uninstall paperclip from the command line? Thx! ...
I'm encountering a very strange problem: my delete actions in rails don't work anymore. Even if I create everything by the scaffold command, every click on delete just sends me to the show view of the object, which should be deleted. script/generate scaffold myitem description:text This isn't only in one project, but extends to new ...
Hi, I've been following Stuart's tutorial at http://www.madebymany.co.uk/tutorial-for-restful_authentication-on-rails-with-facebook-connect-in-15-minutes-00523 and have been having a problem: I get a NoMethodError in UsersController#link_user_accounts; Rails doesn’t seem to recognize “facebook_session”. I have facebooker installed an...
I'd like to figure out a way on how to get to the HTML result (mentioned further below) by using the following Ruby code and the Nokogiri Rubygem: require 'rubygems' require 'nokogiri' value = Nokogiri::HTML.parse(<<-HTML_END) "<html> <body> <p id='1'>A</p> <p id='2'>B</p> <h1>Bla</h1> <p id='3'>C</p> ...
Hello My question involves a few different active records class Respondent < ActiveRecord::Base has_many :phone_numbers, :dependent => :destroy has_many :email_addresses, :dependent => :destroy belongs_to :phone_number, :foreign_key=> "primary_phone_id" belongs_to :email_address, :foreign_key=> "primary_email_id" end class User < Resp...
Hi All, there are several places in my routes.rb file where I say: map.resources :foo, :only => [:show, :index] and I would like to be able to say: map.resources :foo, :readonly => true ..or something of the like. I know this may seem kind of pointless, since it only saves a couple of characters, but I'd like to know how to do it ...
I have a simple page with a single rendered iFrame. There's a link called "Add File" and unobtrusively I would like to attach an event to the "Add File" anchor so that when clicked, it inserts a new iFrame below the existing one with the ID of the iFrame incremented. An example of the iFrame would be: <iframe name="uploadForm1" id="up...
I'm planning on taking the time to actually learn Ruby on Rails in-depth (I've previously done some very minor dabbling with it) so I can hopefully reinvent myself as a Rails developer. The issue I run into though is that there are a fair bit of related technologies that are currently used in the Rails community, and I'm not sure if I s...
Hello everyone I have question regarding associations in Ruby on Rails. In the application there are projects, users, roles and groups. The project belongs to a group with users, a user can belong to many different groups but can only have one specific role within that group. For example: In one group the user is the project owner, but...
We are working on a project that uses Flex and rails with WebORB. Everything was fine and dandy until we started tying the frontend and backends together. We created a service for interacting with users and another for the session. SessionService.rb class SessionService def view_session session = RequestContext.get_session ...
Hello I am getting the an error on the following code in one of my partial views <% form_for (@user) |form| %> SyntaxError in User#edit Showing user/_user_edit_form.html.erb where line #1 raised: compile error ../app/views/user/_user_edit_form.html.erb:1: syntax error, unexpected ';' _erbout = ''; form_for (@user) |form| ; _erbout...
I have a rails application where I store created_at as datetime (standard). I am building a form for searching and I find I have to use find_by_sql to do some complex subqueries. The form has a date range (no time) to search on for items created_at field. The problem I find is that if I pass in just the date string for range to query......
I am working on syncing two business objects between an iPhone and a Web site using an XML-based payload and would love to solicit some ideas for an optimal routine. The nature of this question is fairly generic though and I can see it being applicable to a variety of different systems that need to sync business objects between a web ...
I want to add validations, methods, etc. to a model that is defined inside a plugin. What's the best way to do this? Would it be safe to copy the model file to the app/models directory? ...
In my rails app, I am running a sql query using find_by_sql() since I need subqueries. This works if I do either the first or second query but when I add them together with the AND, it starts complaining about more than 1 row in subquery. I want all rows (records) returned that match the criteria. What needs to be fixed/changes here? W...