Displaying 11 results from an estimated 11 matches for "model_inst".
Did you mean:
mode_list
2006 Jun 18
2
using javascript to get an attribute using an ID
...s[:model], which will be a string, and
use it to load the right model AND to use that model/class?
So, using a string with value of ''user'', how can I do the equivalent of
require ''User'' #(this part isn''t that hard)
#accessing User here is the hard part
model_instance = User.find_by_id(params[:id].to_i)
render :text => model_instance.send(params[:attribute]) #Haven''t tried this
Thanks!
Daniel
2008 May 21
0
Problem with alias_method in a plugin
Hi,
I''m doing my first plugin, based on attachment_fu structure. Here''s
the code: http://pastie.caboo.se/200797.
The problem is that the meta_tag method doesn''t seem to be
overwritten.
I can call model_instance.original_meta_tag and it return same thing
as model_instance.meta_tag, so the aliasing works.
I can call model_instance.foo and it correctly returns class of the
model, so instance method also works.
I''ve set breakpoints on both methods (meta_tag and foo) - calling
model_instance.met...
2013 Oct 25
6
Migrate postgresql database to uuid
Hi all,
I am using rails 3.1 and ruby 1.9.3,Now i want to use uuid concept in
rails 3 for existing data
so i did like :-
create_table :posts, :id => false do |t|
t.string :uuid, :limit => 36, :primary => true
end
ActiveRecord::Base.class_eval do
# old rails versions
set_primary_key ''uuid''
before_create :generate_uuid
def generate_uuid
self.id =
2007 Jan 10
2
Corrupt index and segfaults with heavy writes?
Hi everyone,
We''re running a fairly heavily used Rails app that uses ferret (and
acts_as_ferret) for search. We''re running on mongrel+Apache, Ruby
1.8.4, and ferret 0.10.13. We''re indexing a handful of attributes on
our "Image" and "User" models.
After the system has been running for several days, the index gradually
becomes corrupted, and ferret
2006 Jan 23
8
yield vs @content_for_layout, etc..
I am relatively new to RoR and Ruby for that matter. A few questions
for the pros:
Question 1:
In the 5min ajax video the presenter uses
<%= yield %> in his layout.
In the agile book, @content_for_layout is used.
Since, yield is an actual Ruby construct, is it more efficient and
preferred? What is the difference?
Question 2:
Links are often of the form :action =>
2006 Feb 28
1
Working with date_select ...
I am a little confused about the best way to work with date_select. I see that
in my views it generates a simple input form that allows for the entry of year,
month and date information. If I just leave it at that, great!
But what if now in the controller, I want to work with the date information. I
actually want to take the user input date and compute a new date some number of
days in the
2006 Dec 11
2
Custom Validator
I want to add a custom validator in one of Model. For example Rails has
inbuilt validation methods like validates_uniqueness_of,
validates_presence_of . What I need is a similar kind of method
(example: validates_line_items), that can run my custom code while
saving, updating the record and can add custom error messages to the
record. Please help me by suggesting how i can do this.
--
Posted via
2006 Apr 11
0
Problem using generate/scaffold and FireRuby
...t_callbacks''
>
> c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/c
> allbac
> ks.rb:236:in `initialize''
>
> c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/rails_generator/generat
> ors/co mponents/scaffold/scaffold_generator.rb:182:in `model_instance''
>
> c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/rails_generator/generat
> ors/co mponents/scaffold/scaffold_generator.rb:164:in `create_sandbox''
>
> c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/rails_generator/generat
> ors/co mponents/scaffold/scaf...
2006 Apr 03
18
newbie generate scaffold
Hi Guys
First time on the list and pretty new to the rails way of doing
things, yup I know sorry.. another newbie!
anyway, apologies out of the way, this is the problem I am having...
I have purchased the "Agile Development with Rails" book and have
just started running through the ''Depot'' demo application.
I have got to page 57...
I have my project files all
2006 Sep 03
9
using highlight from aaf
Hi,
I''m trying to use highlight ferret method with trunk aaf and 0.10.1
ferret.
In my search display I use:
Myindexedclass.ferret_index.searcher.highlight(@query, result_line.id,
:content)
* searcher is a protected method; how can I access to the searcher from
aaf ?
* is the doc id in aaf the same as my model id ?
* is the first param, query, the string query or the query object ?
2006 Apr 04
6
connecting to mysql on OS X 10.4
i have looked in the archives, i have the _agile_ book, and its links
right in front of me, and i have done pretty much everything i can
think to do except start from a fresh OS install, and yet i still can
not get Rails to talk to MySQL.
when i try to do this:
237:/Library/WebServer/Documents/Rails/depot chris$ ruby script/
generate scaffold Product Admin
i get this output: