Displaying 20 results from an estimated 20000 matches similar to: "h() aka. html_escape in controller code?"
2006 Feb 14
2
Inline list editing with RJS: best practices
I wanted to get the community opinion on the best way to use partials and
inline list (<li>) editing.
I have a very common scenario where a list is rendered:
--- index.rhtml ---
<ul>
<%= render :partial => ''item'', @collection => @items %>
</ul>
--- _item.rhtml (simplified) ---
<li id="item_<%= item.id %>">
<div
2006 Jan 05
3
has_one :dependent => true question
Hello,
I have two classes that are self explanatory and are listed below.
class User < ActiveRecord::Base
belongs_to :account
end
class Account < ActiveRecord::Base
has_one :account_owner, { :dependent => true, :class_name => "User",
:conditions => "is_account_owner = 1" }
has_many :users
end
In the signup controller when an account is created one user
2006 Jan 20
6
Pre-populate db with yaml outside of testing?
Hi.
What is the best way to pre-populate your database with records while
developing, not testing?
For example, I want to:
1) > [run this command to populate db]
2) > ruby script/server
3) now I can surf to localhost:3000 and my app will already have relevant
data
I''m hoping to use yaml to suck it in.
Is there a way to use the Fixture class to handle this even though this is
2006 Aug 07
16
Monthly billing and payment processor recommendations?
Hi,
I''m setting up a site that will bill on a monthly basis. I would
rather not have to worry about storing customer credit card
information. Does anyone have recommendations on payment processors
that offer monthly billing services?
I don''t want to go the paypal route as I want the user to stay on
the site. I''m hoping to find an API to integrate with. I have
2007 Jan 23
2
SslRequirements plugin and mocha
Hi. I''m loving mocha but have ran into a problem with using the mocha
plugin with a project that has the SslRequirement plugin. It seems
there is some conflict between the two? Any ideas?
$ ruby test/functional/calendar_controller_test.rb
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:478:in
`const_missing'': uninitialized constant
2006 Mar 08
6
best practices for handling uploaded images and capistrano
Quick question: I am going to use the file_column plugin to manage uploading
thumbnails. By default the images are stored in the public/ dir of the
rails project. The problem I see is that when capistrano redeploys a new
build and symlinks it in none of the images will be in the new public/
dir... Does anyone have a solution for this?
Thanks,
Zack
-------------- next part --------------
An
2006 May 02
4
How to extend rails rake tasks?
Does anyone know how to extend the buit-in rake tasks like test:unit.
I want to custom load some fixtures in a particular order.
Thanks,
Zack
2006 Mar 16
5
TimeZone, TZInfo, daylight savings, and composed_of
Does anyone know the best way to track time zone information. There doesn''t
seem to be much documentation on this. So far it seems like a simple db
field like
create table accounts (
id int unsigned not null auto_increment,
name varchar(50) not null,
time_zone varchar(50) not null,
...
primary key (id)
)
and a class like
class Account < AR
...
2006 Aug 24
9
[slightly offtopic] A small, fast Apache2.2 (if there is such a thing)
Hi.
I''m using Apache2.2 built from source + mod-proxy + ssl + svn.
Everything works fine but I''m sure you I could disable a ton of
modules during the build process and in httpd.conf to speed things up
and run a tighter memory footprint.
Has anyone bothered building Apache2.2 from source disabling all the
unneeded modules.
I am planning on going through the Apache docs but I
2006 May 28
7
Self-referential has_many :through relationship
Hi,
I have a self-referential has_many :through relationship setup to
track relationships between users. Basically relationships are
modeled as a join table with an extra column ''relation''.
create table relationships (
user_id integer unsigned not null,
friend_id integer unsigned not null,
relation char(1) not null,
)
--- relations ---
f = friend
r = request to
2006 Jul 11
1
Dynamically setting the session domain?
Does anyone know a way to dynamically change the session_domain option
of ActionController::CgiRequest? I want to have a login section on an
index page (www.example.com) that takes a subdomain, username,
password, authenticates, then redirects to
http://#{subdomain}.mysite.com.
I need to set the session_domain option (to the subdomain) dynamically
so the cookie can be read when the user arrives
2006 Aug 07
5
RJS Change Background Color
What''s the page.method to change the background color of a DOM element? I''m
trying to change the background color of a couple of styled <li>''s when an
Ajax link is clicked.
Thanks,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060807/63de04bf/attachment.html
2007 Apr 30
1
monit config?
Anyone have a a good monit config section for bgrb?
I''m thinking something like this:
check process backgroundrb with pidfile
/var/www/apps/foo/current/log/backgroundrb.pid
start program = "/var/www/apps/foo/current/script/backgroundrb start"
stop program = "/var/www/apps/foo/current/script/backgroundrb stop"
if failed host 127.0.0.1 port 2000 then restart
2007 Jan 16
4
Subdomain Account Keys Best Practice
Hi all,
I''m thinking of useing sub-domains as account keys, something I''ve played
with previously.
I have accounts and users, fairly standard, except that users can belong to
many accounts, and accounts can have many users.
So I figure I need to have an area on the main domain, that allows users to
view their account memberships and things. Sort of like a dashboard for
each
2006 May 30
7
Stripping HTML tags from a string
Hello,
Is there a common way of stripping html tags from a string? Right now I''m
just calling gsub!(/<.*?>/, ''''), but with a background in PHP and always
having used its strip_tags() method, I wonder if the Rails community has
standardized this fairly common task with something a bit less simpleminded
than my quick fix.
Thanks!
Zack
-------------- next part
2006 Aug 08
11
Newb question- method not working
I know this shouldn''t be in the view but to test the code it is.
Anyway if I do just session[user] I get back the user id (the id from
the user table)
which is good.
However this code does not work.
<% a = session[:user] %>
<% uname = User.find(:first, :conditions => id = a) %>
<%= @uname %>
TIA
Stuart
2006 Nov 17
4
set empty values as null in the database
Le''s say that I have a table called people and the column middle_name is
nullable. If the user enters say blank or empty space then in the database
it is recorded as empty space. I would like in all my models all empty
spaces to be recorded as null.
I guess I can write a plugin which will do so for all the models but I''m
sure something like that should already be existing.I
2006 Aug 08
8
RESTful Rails Plugin
I am following the instructions on how to use RESTful Rails plugin found at
http://www.xml.com/pub/a/2006/04/19/rest-on-rails.html?page=3.
When I run the rake test:functionals
I get the following error message:
rake aborted!
undefined method `first'' for :book:Symbol
(See full trace by running task with --trace)
How can I fix this problem? I am using Rails 1.1.4 version. TIA
2007 Feb 07
2
Image Downloads in IE
Hi,
This may not be a rails issue, if not apologies.
I have an application which allows image downloads.
The image is downloaded with the code:
send_data(@wallpaper.image,
:filename => @wallpaper.path,
:type => @wallpaper.image_content_type,
:disposition => "downloaded")
However, Internet Explorer doesn''t download the image, it
2006 Aug 10
6
Login Restfully
In DHH''s keynote, he alluded to doing logins with REST. Has anyone
implemented this, and if so, would you mind elaborating on how you did
it please?
Thanks in advance.
--
Posted via http://www.ruby-forum.com/.