Displaying 20 results from an estimated 200 matches similar to: "Another "escaping" problem"
2006 Jul 17
1
acts_as_tree and :include
hello there,
i have a model that uses acts_as_tree:
>class GbEntry < ActiveRecord::Base
> acts_as_tree :order => ''created_at DESC''
>end
and i want it to paginate, including all children to avoid unnecessary
db queries:
> @gb_entry_pages, @gb_entries =
> paginate :gb_entries, :per_page => 15, :order => ''created_at DESC'',
2007 May 22
2
find :all :include broken on Oracle 10
Hi,
I am trying the following in Ruby using InstantRails 1.7 on WindowsXP
Publication.find(:all, :include => [:doc_type, :release_state] )
but I get the error:
OCIError: ORA-00904: "DOC_TYPES"."PUBLICATION_ID": invalid identifier:
SELECT publications.id AS t0_r0, publications.docid AS t0_r1,
publications.doc_type_id AS t0_r2, publications.title AS t0_r3,
2006 Apr 10
1
random | in join statement with more than one :include
I have an ActiveRecord class that has several has_many,belongs_to,
habtm, and the new has_many => :through relationships.
Whenever I try a
find(:all, :conditions => "some conds", :include [:relationship])
it works fine, but if I have
find(:all, :conditions => "some conds", :include [:relationship,
:other_relation])
it gets a sql error such as
Mysql::Error: You
2006 Feb 17
0
Problem with string "merging" / escaping
I''m on Mac OS 10.4.3, Ruby 1.8.2, Rails 1.0, MySQL 5,
SaltedHashLoginGenerator and I''m seeing a strange problem where
sometimes generated HTML isn''t quite correct, in the following way:
My code:
<%= datetime_select :event, :meet_at, :start_year => 2006 %>
Generated code:
<select name="event[meet_at(1i)]">
["<option
2006 Jan 09
3
Include with two references of one model of the same table
Hey guys,
I just came across this oddity, not sure what to make of it yet, but
I think it might be incorrect behavior. When doing a @inst.find(:all,
:include => ["hometeam", "awayteam"] ...) hometeam and awayteam are two
references from a belongs_to that is of the same model and of the same
table. I will get a pgerror stating that "matches", which is
2006 May 23
11
New "made with Rails" site launched: www.invitika.com
We''ve finally finished up work on our application and are now beginning
our beta. The site (SMS+mobile blogging+event planning+LBS+photos) is
built using 100% Ruby on Rails. Many thanks to all the people who
answered questions over the months on this list. Our experience with
Rails was overwhelmingly positive!
We''d love to hear any feedback you might have:
2006 Jun 25
2
how to write the codes in view?(newbie question)
Hi.
I have two tables and want to join them.
<genres>
id
genre_name
genre_order
<links>
id
genre_id
name
symbol
url
order
display
etc
The code of links_Controller is like below.
def list
@links = Genre.find(:all,:include => :link)
end
Below is the mysql log.
SELECT genres.`id` AS t0_r0, genres.`genre_n
ame` AS t0_r1, genres.`genre_order` AS t0_r2, links.`id` AS t1_r0,
2006 Jan 27
2
Forms and one-to-one association
My models are:
class Event < ActiveRecord::Base
belongs_to :location
class Location < ActiveRecord::Base
has_one :event
The view:
...
<%= datetime_select ''event'', ''meet_at'', :start_year => 2006 %></p>
<%= collection_select(:event, :location, @locations, :id, :name) %>
..
The problem is that in the controller, when I
2006 Mar 14
3
cascading eager loading patch not working in oracle
Notice the "AS" keyword appears many times. Oracle does not support this
keyword:
ActiveRecord::StatementInvalid: OCIError: ORA-00905: missing keyword:
SELECT tim
esheets.id AS t0_r0, timesheets.start_date AS t0_r1, timesheets.status
AS t0_r2,
timesheets.cost AS t0_r3, timesheets.charge AS t0_r4,
timesheets.employee AS t0
_r5, employees.id AS t1_r0, employees.name AS t1_r1,
2006 Jul 05
0
Javascript repeating fields.
The one area I keep hitting my head against in Rails is repeating fields via
javascript. I frequently have forms where one or more fields are actually
broken out into sub tables because there can be multiple simultaneous values.
Rails seems to want to you to use the [] construct in the form helpers (e.g.
text_field(''employee[]'', ''name'')), but I can''t
2006 Aug 14
2
ActionPack: number_to_phone error
Question about the number_to_phone function as provided by rails in actionpack:
http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html
If I do this in my controller:
num = number_to_phone(params[:phone_number])
I get this error:
undefined method `number_to_phone'' for #<TicketsController:0xb7a2bfcc>
Whereas if I do this in my view:
<%
2007 Nov 29
3
Stylistic preferences
What are people''s opinions on which of these two styles is better to
use?
1) before
---------------------------
module UserSpecHelper
include GenericSpecHelper
def valid_sms_attributes(phone_number="12345")
{ :phone_number => phone_number }
end
end
describe User, "with phone number" do
include UserSpecHelper
before(:each) do
@user =
2013 Oct 08
4
'puppet storeconfigs export' killed
Hi,
I currently have a MySQL database containing all Puppet storeconfigs. My
intention is to migrate to PuppetDB on a PostgreSQL server, so the first
step is to use the ''storeconfigs'' face to export all the DB to a file
PuppetDB can later consume. But the ''puppet storeconfigs export'' command
always ends up being killed, I suspect due to some sort of OOM
2009 Sep 21
0
Polymorphic form
I have two partials to deal with contact information. The Contact
information uses single-table polymorphism. I want to be able to use
save on Contact and set ''type'' manually, based on the type of form the
user is filling in. This is saved as the value on a hidden field.
class Contact
belongs_to :person
acts_as_list :scope => :person
validates_presence_of :type
2007 Jul 12
0
is it possible to get id of the matched field?
i want to create link on the matched field:
f.e. i have person and phone models.
class Person < ActiveRecord::Base
has_many :phones
acts_as_ferret :fields => [:phone_numbers]
def phone_numbers
phones.collect{|phone| phone.number}
end
end
search result''s page lists out people with matched phone_numbers
highlighted.
i want to create link on matched phone_number to get
2006 May 16
1
:conditions on has_one realationship
Hi there,
I''m currently building a membership application and I want to be able
to select, not just all the memberships, but the most current
membership from the database on a per user basis. I have linked the
tables as shown:-
class Membership < ActiveRecord::Base
belongs_to :payment
belongs_to :person
end
class Person < ActiveRecord::Base
has_many :memberships
2007 Jun 24
6
I only want one type of model returned from a multi_search
I am trying to use acts_as_ferret''s multi_search to search across
multiple models, but i only want it to return one type of model.
for example i have a page that lists out people. on this page it shows
email addresses and phone numbers. I want to be able to search by any
fields directly from the person model and search the fields from the
email_address and phone_number models, but I only
2006 May 23
5
AR Caching and Reflection
When I do this:
term = Term.find(1, :include => :definition)
term.definition.term
Two SQL queries are fired, why?
--
Posted via http://www.ruby-forum.com/.
2006 May 24
1
does select support arrays in a form with multiple models?
i have a one-to-many model (an addressbook of contacts with many phone
numbers). i want to represent a select element so that its name is an
array containing the phone_number id...
<select id="phone_number_1_location_or_kind"
name="phone_number[1][location_or_kind]">
<option value="Work">Work</option>
<option
2006 Mar 01
0
Possible bug in ActionMailer (with patch)
I wanted to write the following code, with emphasis on adding my own
headers to the second part with the :headers parameter.
class ArticleMailer < ActionMailer::Base
def test_message
subject ''This is a test''
recipients ''elan@bluemandrill.com''
from ''Exemplary Products <info@example.com>''