Displaying 20 results from an estimated 70000 matches similar to: "Regula expression ruby question"
2006 Jul 26
2
How to highlight the search term in the search result
In the ''basecamp'' product from 37signals if I search for ''ruby'' the I get a
bunch of results. In the search result page the search term (ruby in this
case) is highlighted.
I was wondering how to accomplish the same.
How to highlight the ''search term'' in the search result? Is there any
already existing utility that I could use?
Thanks.
2006 Aug 09
6
How to change the error message easy way
validates_presence_of :fname
results in the error message
"Fname can''t be blank".
What I want is "First Name can''t be blank".
I could do this
def validate
errors.add_to_base("First Name can''t be blank") if fname.blank?
end
I find this clunky and I have to put everyrhing in the validate method. Is
there an easy to get what I want.
I
2006 Apr 27
2
How to override pagination_links method
I intend to override pagination_links method.
I added following lines of code in application_helper.rb
module ActionView
module Helpers
def pagination_links(paginator, options={}, html_options={})
raise("boom!!")
end
end
end
But my code is not executing my code. The view is still using the method
pagination_links from rails.
What''s the correct way to override
2006 Jul 05
2
How to write get functional test when there is no action by that name
I have following line in route.rb
#event info for an event name
map.connect ''event/:name_url'',:controller => ''home'',:action =>
''event_info''
It causes a URL like http://localhost:3000/event/_jewels_exhibition_ to be
sent to the home controller with action as ''event_info''.
I am trying to test this action. My first
2006 Jan 31
2
Relationship navigation issue
class Event < ActiveRecord::Base
belongs_to :venue
belongs_to :category
end
class Venue < ActiveRecord::Base
belongs_to :city
end
class City < ActiveRecord::Base
belongs_to :state
end
I want to retrieve all event records belonging to a state. Coming from
hibernate background I tried something like this:
def self.list_for_a_state(state_id)
find_by_sql(["select e.*
2006 Jan 14
3
How to render from a different controller
My code is something like this.
class FirstController < ApplicationController
def foo
#some processing
render (:controller => ''second'', :action => ''index'')
end
end
I tried using both render and redirect but it seems it''s not possible to
send the control from within a controller to some other controller. Am I
missing something
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
2005 Oct 25
3
How to get the source code for login generator
Hi,
I installed login generator using gem. It''s installed and it''s working fine.
I wanted to browse the source code of login generator installed by gem. I
couldn''t find the source code anywhere.
Thanks.
-=- Neeraj
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
2006 Jan 20
2
select_time issue: how to get hours only upto 12 along with AM/PM
My code is like this:
<%= select_time () %>
1) I would like to pass more options so that the a blank value is at the
top. I tried ":include_blank => true" but it didn''t work.
2) I would like to limit the number of hours to only upto 12. With the
current code the hours has value rangin from ''00'' to ''23''
3) Would like to have
2006 Jan 11
6
How to display the error messages from the controller
I have a wizard which consists of two pages. To keep it simple let''s say
that the first page asks the user to select a state from the drop down menu.
In case the user doesn''t select any state, an error message needs to be
displayed.
Ideally I would like to do something like this.
def new
selected_value = params[:addevent][:state_id]
if selected_value == "-1"
2006 Jun 07
5
How to test RSS feeds while developing it on localhost
Hi,
I am developing on windows xp and am trying to create RSS feed for an app
using RoR. How do I test my RSS feed while I am developing it. I don''t know
of any feed reader that would accept localhost as the input.
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2006 Jun 27
2
testing - how to get access to an instance variable
inside controller
def foo
@city = City.find(@params[:id])
@city.bar = 1234
end
While writing functional tests how do I ensure that the @city.bar is 1234?
def test_edit
get :edit, :id => 1
assert_not_nil assigns(:city)
#?? how to assert that city.bar is 1234
end
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2006 Jun 05
3
How to get dd mmm and yyyy from dd-mmm-yyyy
The input values could be something like this:
01-Dec-2006
01-December-2006
1-June-2006
Is there an easy to way to get the three variables populated dd, mmm and
yyyy for any of the above input values? I tried to look at regex but couldn''
anything simple.
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2006 Jun 21
1
Project/Job: Ruby on Rails - Denver, CO
Kforce is currently seeking a Ruby on Rails Web Developer project in
downtown Denver. The client is open to perm employee or consultants.
POSITION OVERVIEW: Develop Ruby on Rails applications to extend existing
platform for client''s public facing website.
Environment: Mac OS X with deployment on Linux servers.
RESPONSIBILITIES:
1. Implement software as needed to accomplish features
2006 Feb 28
0
Ruby Feedparser and exceptions on valid feeds
I am using Ruby Feedparser and keep running into situations when a feed is
valid but feedparser throws an exception - REXML::ParseException:
Declarations can only occur in the doctype declaration.
The following feed does validate at feedvalidator.org (with a warning, but
does validate):
http://www.engadget.com/rss.xml
However, when I run feedparser I get this error:
<REXML::ParseException:
2005 Oct 14
1
Diff between attr_accessible and attr_accessor
I''m going though the paper back edition of agile development with Rails. On
page #128 I encountered following lines of code:
attr_accessor :password
attr_accessible :name,:password
What''s the difference between attr_accessor and attr_accessible?
-=- Neeraj
_______________________________________________
Rails mailing list
2006 Mar 31
3
Position For Ruby on Rails Consultant
Hello Everyone,
My name is Prashant and I head the placement division with ANZ Solutions. We
work with close to 53 clients all over the country and help them with their
staffing requirements. I like to network with strong technical people like
you and like to associate myself with respect to your career plans. Please
let me know and I will give you a call. We can help you for any kind of
2006 Jun 24
1
@version_control_book not available while testing - AWD book 1 page 148
In the page 148 of the AWD book it''s mentioned that the while testing
@products and @version_control_book are automatically made available.
That''s not the case with me. In my test environment I don''t get those two
variables.
I was wondering if anything has changed in Rails 1.1 because in the new
edition of the book (AWD - edition 2) there is no mention of such
2006 May 08
1
How to check if a given string is a valid float value or not
I can''t use active record or anything. I need to validate inside the
controller. I thought I could use to_f in the string method. The problem is
that for a value of 1.3fsfs it returns 1.0 . I thought it would be
consistently 0.0 . I can get a hack around it but looking for an elegant
solution.
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2006 Jul 21
1
How to dynamically add more rows and submit data
Let''s assume that I am trying to build an application where the user can
enter invoice.
In the app the user can add lines items. Each line item has decription,
date, rate and hours.
When the invoice screen comes up the first time I have one blank row for the
line items.
<tr>
<th>Description</th>
<th>Date</th>