similar to: Is there AR magic for this?

Displaying 20 results from an estimated 9000 matches similar to: "Is there AR magic for this?"

2006 Apr 10
4
Best way to propogate model rules to controller?
Hey everybody, I''ve got a model that represents kind of a turn-based games. Certain actions can only be made unders certain conditions. For simplicity, we''ll say that the only condition for a particular action is that the weekday be Tuesday. def add_vote raise ''You cannot vote today'' unless Date.today.wday == 2 ... end In my controller I want to show a
2006 Feb 21
3
AJAX sub-list
In the new / edit screen for an "item" I''d like to be able to add/remove "sub-items" on pressing an add button below the "sub-items" a bit of a form shows up with the html looking something like: <div id="uniqueid"> <!-- label etc here --> <input type="text" id="sub_items[]" name="sub_items[]"
2006 Apr 24
12
Design Decisions
Hi All, I am doing some research on how people start with their Rails app. What design decisions are made and how is it build. For example: - do you use scaffolding and go from there? Or do you create everything from scratch? - are you using multiple controllers? Or do you put everything in one? - do you use migrate? - how do you use migrate? Do you call migrate your self or do you use the
2006 Jan 24
3
Merging two heavily referenced records into one
Here''s the situation: I have a "people" table whose "id" column serves as a foreign key to several other tables (authorships, editorships, members, users, etc.). Every now and then I will find two distinct records in the "people" table that represent the same human being. They generally differ by small differences in spelling but should really be the
2006 Feb 10
7
convert rails object to javascript variables
Am i a total idiot to try and parse out a rails object for javascript in this way? <% for i in interface_items[0].attributes %> var <%= i[0] %> = "<%=h( i[1] )%>" <% end %> Am I missing something really obvious? Thanks, Mark -- -------------------------------------------------------------------- I am Mark Daggett and I approve this message.
2006 Mar 16
23
AJAX on Mobile Internet Explorer
Hi! I try to get AJAX running on a mobile Windows Mobile 5.0 based device and failed. There should be a JavaScript support but nothing happens. Have any of you experience with the rails javascripts on a this platform or are there any hints, documentation on the net? tia, -- Daniel V?lkerts Protected by Anti Pesto.
2006 Apr 30
82
Mongrel 3.15, Ubuntu and Park place (S3)
Hello. I installed under Ubuntu (Dapper) Park Place. I followed the instructions given at the RedHanded site. I get the following mongrel error when launching the application: ** Please login in with `admin'' and password `pass@word1'' ** You should change the default password or delete the admin at soonest chance!/usr/lib/ruby/gems/1.8/gems/mongrel-0.3.12.5/lib/mongrel.rb:584:in
2006 May 01
2
Find by time?
I''m trying to find events created after an initial date. I''m sure it''s something obvious, but I''m not sure why this isn''t working: def self.find_recent find(:all, :conditions=>"created_at > #{Time.local(2006, 4, 27, 22, 0, 0)}") end Time for more caffeine for me...
2006 Mar 02
1
Coding conventions (mostly AR)
I have the following tables: Users, Clients, Roles, Assignments(user_id, role_id, client_id) and Rights(controller, action). First of all, I''d like to know if hooking things up this way makes any sense. Could perhaps add a second join table between assignments and roles, but not sure that would add any value. What i''m really wondering about, though - is how to do things the
2009 Dec 15
0
Problems reloading plugin extending AR model
Hi, I have an AR model called Entity, which is extended in a plugin like this (this is in a file under lib/ which is required by init.rb of the plugin): http://github.com/dedomenon/madb_notifications/blob/master/lib/madb_notifications_lib.rb#L8 Entity.class_eval do def user_subscribed_to_creation?(user_id) NotificationSubscription.find(:first, :conditions => [ "source_filter
2006 Mar 26
2
Shared Columns in an STI
I have a an STI table which acts_as_tree, that has a large number of classes/types. My common fields are: id parent_id name description with 4 more text fields, I could cover most of my classes if I could redefine the name of the field like this. text1 AS address1 text2 AS address2 text3 AS zipcode For one class and text 1 AS model_number text2 AS vendor Is there a construct that will allow
2006 Apr 02
6
Neat style trick
Not terribly exciting, but I was happy to think of it. I needed a div with a fixed height that could vary depending on page content. So I did this: <div class="listcntnr" style="height: <%= @users.size / 2 * 125%>px"> Whee! --Al Evans -- Posted via http://www.ruby-forum.com/.
2006 May 24
1
AR many-many join tables - can they have created_on, updated_on ?
Hello all, I''m creating a many-many join table between ''homes'' and ''users''. Can it contain created_on? will AR update created_on, updated_on on this table? CREATE homes_users ( home_id int not null, user_id int not null, created_on datetime null, updated_on datetime null ) Thanks for your advice! -- ------------------------------ Apple MacBook.
2006 Feb 14
2
AJAX on page load
Ok, I''m missing something obvious but after some reasonable looking in _The_ Rails book (sorry haven''t gotten the cookbook yet) and these archives I don''t see a solution to my question. Question: What is the cleanest way to load a div via AJAX when the page loads - no user action necessary. I don''t really want to hack in a hidden remote form or link that is
2006 Jul 07
4
need help with some ugly code - is there a better way?
Hi, In my user_controller.rb, I have the following method, which is supposed to send the user to their profile, dependng on what "role" they are (the roles correspond to the other controllers: venue, band, fan): def login if request.post? if session[:user_id] = User.authenticate(params[:user][:login], params[:user][:password]) flash[:message] =
2005 Nov 03
0
AR model and virtual attributes
i have a need to create a ''virtual'' attribute. Is the following possible? class User < ActiveRecord::Base # user things are owned by user at his selected location has_many :owned_things, :class_name => "Thing", :conditions => ''user_id = #{id} and location_id = #{location_id}'' attr_accessor :location_id end class AccountController <
2006 Dec 05
2
intro + specification remarks + some questions
hi everyone, since about 10 days I've been working on an implementation of ogg vorbis *decoder* from scratch, and I've got a few constructive remarks about the specs and some questions. -------------------------- First a question: > 9.2.4. low_neighbor > > "low_neighbor(v,x)" finds the position n in vector [v] of the greatest > value scalar element for which
2020 Sep 30
4
How to use ssh -i with a key from ssh-agent rather than from a file?
Hi, I have a VM with a git repository whose origin is on github. I have several keys known to github, so I needed to set git's core.sshcommand config parameter in the repository to something like this: ssh -i ~/.ssh/id_ed25519_github2 But it meant that I needed to copy that key to the VM. The same key is available via my forwarded ssh-agent connection. Is it possible to tell ssh to use
2018 Jan 12
0
best way to represent this pseudocode in LLVM IR?
Greetings, I implemented a proof of concept of something I'm calling "error return traces" in my frontend (screenshot and explanation at this link): https://github.com/zig-lang/zig/pull/684 Now I'm trying to minimize the runtime size. Here's some example IR that I generate: define internal fastcc i16 @baz1(%StackTrace* nonnull) unnamed_addr #2 !dbg !69 { Entry: %1 =
2010 Feb 16
0
Strange routing(?) Issue
I have a Model event and the following two lines in routes.rb 1 - map.connect "events/:action", :controller => ''events'', :action => / [a-z_]+/i 2 - map.resources :events, :has_many => :comments, :has_one => :address #, :collection => {:mapit => :get} I have #1 so that I can call custom actions from a link_to_remote link from my index page t0 update a