Displaying 20 results from an estimated 2000 matches similar to: "Migration Help"
2006 Mar 20
1
Migrations with multi-column indexes
Hey Folks,
I can''t really glean this from the documentation.
Is there a way to do: add_index(table_name, column_name, index_type)
within my migration for an index that spans multiple columns? Ie: A
covering index on FIRST_NAME, LAST_NAME or something like that?
Best,
Brian
---------------------------
Brian Corrigan
---------------------------
2012 May 21
4
Getting model column names
Hello,
I am writing a RoR application that connects to a couchDB database using
couchrest_model.
The definition of my model is the following one:
class BdsDataAuthor < CouchRest::Model::Base
property :id, Integer
property :first_name, String
property :last_name, String
end
I would like to be able to get the list of the model columns, e.g., the
result of
BdsDataAuthor.columns would be
2006 Jul 21
1
Partial, Table Layout, Multiple Controllers/Models... DRY?
Hi,
I am almost embarrased to ask this and I am sure it has been answered
previously but the search feature is down on ruby-forum so I am not
finding the answer.
I have several controllers (leads, orders, activities, etc...). I have
a ton of repeated html in each of the views for these controllers. For
example, my list view has the same table/tr/td and for..in type of code
and it just
2006 Jul 22
3
refactoring commonly used aggregations
I have a number of models that use an aggregation to combine First Name,
Middle Initial and Last Name and they have been working fine. I am
looking to clean this up, DRY it if possible.
I have things like this in application.rb
class Clwholename
attr_reader :first_name, :middle_initial, :last_name
def initialize(first_name, middle_initial, last_name)
@first_name = first_name
2006 Jul 03
9
Migrations from Mysql to Oracle. PLS HELP!
Hi all,
I''m using Rails/Mysql as development platform. the production server is
under Rails/Oracle.
Right now, i''m trying to install my application under the production
server, the connection to orcale is fine via Rails, but i have a weird
problem. example :
here is a extract from my db scheme :
Table User :_____________
id_user |
first_name |
2006 Mar 30
6
MS SQL query strangeness for ActiveRecord in Rails
Hi,
I am currently trying to move my rubyonrails app from Linux to Windows
server utilizing MS SQL instead of MySQL due to "business" reason. All
my listing screen utilize a drop down list in each column to allow user
to "filter" the listing based upon the value chosen from the drop down
list. In the controller, I used find() method but with customized
parameters such as
2006 Aug 11
0
SQL sort
in my list action, I setup the sort parameters as folows :
..
sort = case @params[''sort'']
when "login" then "login DESC"
when "first_name" then "first_name DESC"
when "last_name" then "last_name DESC"
end
...
to be used in a ''sort_link_helper''
2007 Nov 06
2
Why is this view spec failing?
I can''t figure out why I am getting a failure. It renders out fine in
the browser.
<h1>New member</h1>
<%= error_messages_for :member %>
<% form_for(:member, :url => members_path) do |f| %>
<fieldset>
<legend>Member Info</legend>
<p><label for="member[first_name]">First Name:</label> <%=
2007 Aug 26
2
Multi-word query searching across columns
I''m trying to implement a basic name search on a People table with
separate first_name and last_name columns. I am using the
will_paginate plugin and have the following search method in the
model:
def self.search(search, page)
paginate :page => page,
:conditions => ["lower(last_name) like ? or
lower(first_name) like ?",
2006 Jan 19
2
Simple Ferret Questions
I am trying to use Ferret for searching for users based on first and last name.
In my index, I am adding the first_name, last_name, and a full_name
which is basically "#{first_name} #{last_name}".
I am searching the index using something like the following query:
INDEX.search_each(%Q/first_name:#{query}* OR last_name:#{query}* OR
full_name:#{query}*/) do |doc, score|
The problem I am
2010 Mar 26
2
How to read a xml file?
How to read a xml file?
I have this XML source:
-------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<fichas>
<ficha>
<nombre>Gabriel</nombre>
<apellido>Molina</apellido>
<direccion>Alfredo Vargas #36</direccion>
</ficha>
2006 Aug 07
3
wrong number of bind variables
I''m getting this error message since i moved alot of the database
logic to the model.
wrong number of bind variables (0 for 2) in: first_name = ? AND last_name = ?
def self.authenticate(first_name, last_name, password)
user = User.find(:first, :conditions => [''first_name = ? AND
last_name = ?''])
if user.blank?
Digest::SHA256.hexdigest(password +
2006 Jan 03
0
has_and_belongs_to_many include problem
hey,
i have users who are in groups, and i have a search form, where i can search on
group, user lastname, and user firstname.
All this is also with pagination.
these are my models
class User < ActiveRecord::Base
has_and_belongs_to_many :groups
end
class Group < ActiveRecord::Base
has_and_belongs_to_many :users
end
in my controller i do this
THIS works (but in need pagination)
@users2
2006 Aug 07
2
Bind variables error
wrong number of bind variables (0 for 2) in: first_name = ? AND last_name = ?
I''m not sure why I"m getting this error ?
def self.authenticate(first_name, last_name, password)
user = User.find(:first, :conditions => [''first_name = ? AND
last_name = ?''])
if user.blank?
Digest::SHA256.hexdigest(password + user.password_salt) !=
user.password_hash
2014 May 29
0
How to make the tests pass in an elegant way? Ruby on Rails
I am writing a rails app with my colleague who wrote a lot of the tests.
He had to take a leave of absence due to a death in his family, and I am
needing helps with changing the model so that the tests will pass in our
spec file.
Here is the model:
class Worker < ActiveRecord::Base
attr_accessible :first_name, :last_name
has_many :writings
end
Here is the spec:
2006 Mar 20
2
AHHHhhhhh... has_and_belongs_to_many, that is going on?
I don''t have a class by the name of "ReviewersScoreCard", yet my many to
many configuration looks as follows. And, these errors while running some
simple test with ./script/console is giving me a headache:
./script/console
Loading development environment.
>> r = Reviewer.find_first
=> #<Reviewer:0x19d0a48 @attributes={"id"=>"1",
2009 Nov 06
0
Nested objects not propagating from view
I thought I had this fixed, but apparently not. It works okay from the
console, but not from the view. I have the following:
# partial schema
create_table "users", :force => true do |t|
t.string "login", :null => false
t.string "first_name"
t.string "last_name"
t.string "email", :null => false
2006 Jul 14
1
creating a computed column with activerecord for to_xml
Hi. I have a question about activerecord, computed columns and to_xml.
I have a simple model called person that has a first_name and a
last_name field (and thus a first_name and last_name field in the Person
table). When I :find a model and call to_xml, I would like the result
to not only send back first name and last name as xml but also add an
additional attribute called full_name that is
2014 Apr 21
0
Unpermitted Parameters - Rails 4
Hi,
I'm using Devise (3.2.4), Rails 4 and I'm trying to signup.
I have a Registration Controller where i do have:
"
def sign_up_params
params.require(:user).permit(:email,:first_name,
:last_name,:mobile, :birthday, :current_password,
:password,:password_confirmation)
end
"
and everytime i try to sign up I get the following message:
Processing by
2010 Oct 05
2
Is it possible to query on virtual attributes?
I have a Person model with attributes first_name and last_name.
I want to implement autocomplete search that looks that the entire
name. Hence I have a method:
def full_name
self.first_name + " " + self.last_name
end
Is it possible for me to query on full_name and have rails match the
first_name and last_name fields?
I currently receive this error when I try, because full_name