Displaying 20 results from an estimated 3000 matches similar to: "Database best practices?"
2012 Aug 14
3
validates_format_of :message not working, validates_length_of :message is working
I''m using validates_format_of and the validation I want to do works, but I
can''t get an error message to be displayed if the data is invalid:
validates_format_of :mobile, :with => /\A[\+0-9]+\Z/, :message => " - Wrong"
I have another validation some where else that does display the error
message: " - Name is too long"
validates_length_of :name,
2007 Oct 13
4
Chapter 9
Hello,
I''m currently stunk on this issue for few days and I do not know how
to get it fixed.
The system always raises this error message :
order is closed
and here is my order.rb:
class Order < ActiveRecord::Base
include ActiveMerchant::Billing
before_validation :set_status
attr_protected :id, :customer_ip, :status, :error_message, :updated_at, :created_at
attr_accessor
2006 Jan 24
1
Query String in routes.
Is there any way to access the query string full request uri in routes.rb?
I''d like to route requests for those going after my old application urls to
my new rails application urls.
The old app used
/wiki.cgi?PageName
The rails app uses
/wiki/show/PageName
Like...
map.connect ''wiki.cgi'', :controller => "wiki", :action => "show", :id =>
2006 Aug 17
2
validates_length_of with char field
I am new to ruby/rails and am having a problem with validates_length_of.
It seems to work fine on a varchar field, but when I try it on a char
field the extra characters are silently truncated and the message
appears that the record was successfully updated.
How can I get my app to produce my error message instead? I''ve tried
various variations, but here''s one of my tries:
2012 Jul 17
24
Static Pages from Railcast
Hi everyone,
I need several pages to be static but also modify when requested. I try
following the railcast from Ryan at
http://railscasts.com/episodes/117-semi-static-pages?view=comments
Here what I have done!!
rails g scaffold Pages name:string permanentlink:string title:string
author:string access_level:string is_published:boolean
meta_description:string meta_keyword:string
2015 Aug 22
2
Russian wiki
On 22 August 2015 at 19:20, Ilyas Arinov <arinov.ilyas at gmail.com> wrote:
> I have to update pages twice now to see its content.
>
> --> -->
>
> Traceback (most recent call last):
> File "/usr/lib/python2.6/site-packages/MoinMoin/request.py", line 1207, in
> run
> handler(self.page.page_name, self)
> File
>
2015 Aug 22
2
Russian wiki
I am not sure, but ru section fails to load now. Last changes was
translating SIG section. Please, help to fix this issue.
2015-08-22 21:24 GMT+06:00 Ilyas Arinov <arinov.ilyas at gmail.com>:
> Thanks. Now I can do it by myself.
>
> 2015-08-22 19:43 GMT+06:00 Alan Bartlett <ajb at elrepo.org>:
>
>> On 22 August 2015 at 14:37, Akemi Yagi <amyagi at gmail.com>
2007 May 12
3
Setting form-values
Hi,
I''ve recently had some trouble setting form values in my code - for example:
require ''rubygems''
require ''mechanize''
def save(pagename, content, editsummary = '''')
agent = WWW::Mechanize.new
agent.user_agent = ''Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)''
page =
2006 Jan 30
9
Something as after_successful_validation?
I need to call callback only if the validation was successful, but it
seems it is called also when validation fails.
--
Posted via http://www.ruby-forum.com/.
2006 Aug 14
4
Controller method problem
Hi,
I have a def in my controller see below where i want to find the page
object based on a parameter value and then use the page_id to then find
all the contents that belong to that page in the same method.
Controller
def aboutus
@page = Page.find_by_name(params[''About Us''])
@contents = Content.find(:all,
:conditions => "page_id = #{@page.id}")
end
2005 Jul 07
3
NameError Exception
Ruby/Rails n00b here so go easy on me...
I''ve been wracking my brain trying to figure out what is wrong here.
I''ve checked all my models for the appropriate belongs_to, has_many,
etc. I''ve checked to make sure I''m using singular and plurals in the
right spot. I''ve checked my syntax around all my "within"''s and nothing
seems to fix
2006 Jul 05
2
Serialized object behaves weird
Hi!
I got a class named EinsatzFilter which I serialized to session. Before
saving to session it works afterwards I keep getting the message:
"undefined method `to_s'' for #<Person:0x38c6ab8>". "Person" is a from
ActiveRecord::Base inherited class.
Code:
class EinsatzFilter
include ApplicationHelper
attr_reader :personen, :monat, :projekte, :kunde
2006 Jul 27
9
Introspecting validates_presence_of
Hello people,
I''d like to detect whether an attribute of a model has
vaildates_presence_of applied to it so I can automatically apply a
mandatory (*) to the field...it doesn''t look easy...any ideas?
Cheers,
--
Dan Webb
http://www.danwebb.net
2007 Mar 26
2
Strange Record not saved errors
I have a site with an acts_as_authenticated based login which has
started throwing up some strange errors. Until a few days ago
everything worked fine but all of a sudden ''RecordNotSaved'' errors are
popping up in my logs.
When I check the database, it looks like the record _is_ saved but I
think users get an error so I''m starting to see a lot of double/triple
entries
2012 Aug 22
3
Libvirt Seg Fault when compiling either 0.9.13 or 0.10.0-rc1
Hi all,
I am trying to install a version of Libvirt that will be compatible with
qemu-kvm-1.1 but I cannot seem to get Libvirt to compile. During the make
portion of the install I get the following error:
...
make[4]: Entering directory `/home/shawn/libvirt-0.10.0/docs'
Generating 404.html.tmp
/bin/bash: line 5: 59204 Segmentation fault /usr/bin/xsltproc
--stringparam pagename $name
2010 Nov 11
5
ActiveRecord query
I have these sql code in postgresql
"SELECT * from convenios where id NOT IN
(SELECT convenio_id from solicituds where usuario_id=?"
but don''t find a way of used it in rails
except
find_by_sql.
There is a another way??
class Usuario < ActiveRecord::Base
belongs_to :persona
has_many :solicituds, :dependent => :destroy
has_many :convenios, :through =>
2012 Aug 16
1
How to create subpages.
What I am trying to do is create subpages within the main page.
So if the top navigation is
- Home
www.example.com/
- About
www.example.com/about
- Contact
www.example.com/contact
- Support
www.example.com/support
I would want a sub navigation under the pages like so;
- Home
www.example.com/
- About
www.example.com/about
----- History
www.example.com/about/history
----- Locations
2007 Feb 23
2
how to remove spaces from phone number
Hi,
I need to allow login based on the phone number. During the signup they
can give the number in any format with spaces, slash or (). But for
storing in database and then during login to compare I just want the 10
digit number. How can I remove the special char from phone number before
storing to db ?
Thanks.
--
Posted via http://www.ruby-forum.com/.
2006 Apr 13
1
Model is not a class
I''m trying to specify a model in a controller, but rails gives me
"Account is not a class", where Account is my model name ...
This is my model:
class Account < ActiveRecord::Base
validates_presence_of :email, :email_confirmation,
:username, :password, :password_confirmation
validates_format_of :email,
:with =>
2009 Sep 19
1
validations on a field
hi, i have a model with 2 validations on a field
example:
validates_presence_of :email
validates_length_of :email, :within => 6..100 #r@a.wk
validates_uniqueness_of :email
validates_format_of :email, :with =>
Authentication.email_regex
if i do the submit of form for a new object of the model with a blank
mail
i receive 4 errors.
In this case i want receive