similar to: [NQ] How to set an initial FK for a new item of something?

Displaying 20 results from an estimated 1000 matches similar to: "[NQ] How to set an initial FK for a new item of something?"

2006 Apr 17
2
has_one problem in a form
Hello all, I have a syntax question. How does one refer to a field brought in via a has_one/belongs_to relationship in a form helper? Basically, I have two models: class Resource < ActiveRecord::Base has_one :other_thing end class OtherThing < ActiveRecord::Base belongs_to :resource end It has the normal id-resource_id foreign key relationship. OtherThing has two fields, plus the
2007 Nov 06
4
help on helper module inclusion/extension
I want to include helper methods included to my Camping App from by requiring an external file but I can''t seem to include helpers from another module. module CampingHelpers def self.included(base) base::Helpers.send(:include, Helpers) end module Helpers def show_test p "test" end end end Camping.goes :CampingApp ... module
2007 May 07
3
Module Madness
I''m wanted to make a "global" module that I could include in my application for some shared code between them. I''ve been making several camping apps and wanted them all to share a helper/partial that contained the navigation. I ran into a lot of difficulty when trying to include it, the primary problem being "methodUndefined" errors. I did finally get it to
2007 Dec 18
16
shared behav
hi, i want to make a behavior shared between models, the examples need to create new instances etc. Is there a way to pass the model class to the shared behavior? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20071218/5b400cc5/attachment-0001.html
2006 Nov 14
11
RESTful mixin, mixin repo?
Hi, I just put together a little mixin to provide pseudo-RESTful services in camping apps. Basically, it looks for a hidden _verb field in form posts, and sets the @method to the supplied value (e.g. put or delete - which browsers don''t support). This lets you define put and delete methods in your controllers. Groovy. Code: http://pastie.caboo.se/22613 Is there any permanent repo of
2009 Apr 10
0
ActiveRecord belongs_to ActiveResource
class Thing < ActiveRecord::Base belongs_to :other_thing end class OtherThing < ActiveResource::Base self.site = ... end The association here works. I can access other_thing from thing with no problems until, as usual, testing. Specifically functionally test the things_controller. The things controller is simple scaffold, however, having the association to an active resource model
2006 Oct 05
4
search results autocompletion
Dear list, I ''m using a text input field with autocompletion . The suggestions come from a ferret index which is created by getting all the terms belonging to other indices. Here is the code: class Suggestion attr_accessor :term def self.index(create) [Person, Project, Orgunit].each{|kl| terms = self.all_terms(kl) terms.each{|term| suggestion =
2009 Mar 19
6
[Cucumber 0.2] Failure to use should
I have a step definition like this: Then "the account should be created" do account = Account.find_by_name("my shiny new account") p account.class account.should_not be_blank end When running this step, I got the error message: Account(id: integer, name: string, state: string, next_renewal_at: date, created_at: datetime, updated_at: datetime, full_domain: string,
2006 Apr 27
4
how to make views changable
Hello I need to make site views changeable I found how to change layouts but it is not enough, becouse templates can use different ways to display and organize content. I found one way to do this, but i need to make subfolders in my ''view/layouts'', ''view/controller_name'' both and to create additional subfolder somewhere in ''public'' to put
2007 Dec 17
6
Checkbox array and Ajax.updater
Hello all, I have some checkbox array like these: <input type=checkbox name=list[] value="1">Java<br> <input type=checkbox name=list[] value="2">JavaScript<br> <input type=checkbox name=list[] value="3">ASP<br> <input type=checkbox name=list[] value="4">HTML<br> <input type=checkbox name=list[]
2006 Apr 05
9
Is eval the only way?
Hi, I''m trying to write some methods which use a parameter to represent a Class name. A very simplistic example: def foo(class_name, conditions) x = class_name.find(:all, :conditions => "#{conditions}") end Unfortunately, this does not work. The only way around this problem that I can think of is to use eval: def foo(class_name, conditions) x = eval
1998 Jan 15
2
R-beta:0.61.1 Problem with "make docs"
The problem is the following # make docs Make: Don't know how to make ../src/library/*/man/*.Rd. Stop. *** Exit 1 (ignored) # I am using a DEC alpha 200/4/233 with Digital Unix 3.2D My previous version of R was R-0.50-a1. I have installed around 3 or 4 previous versions on the same system and never had a problem (but, then the Makefile was very different). The first make to compile
1998 Jan 15
2
R-beta:0.61.1 Problem with "make docs"
The problem is the following # make docs Make: Don't know how to make ../src/library/*/man/*.Rd. Stop. *** Exit 1 (ignored) # I am using a DEC alpha 200/4/233 with Digital Unix 3.2D My previous version of R was R-0.50-a1. I have installed around 3 or 4 previous versions on the same system and never had a problem (but, then the Makefile was very different). The first make to compile
2007 Mar 21
2
store_class_name for Comatose:Page model
Hi, I have three models: Comatose::Page, Article and Product. In all of them, store_class_name is set to true. Now, when i do: results = Comatose::Page.multi_search("*", [Article,Product], options) I get: wrong constant name Comatose::Page #{RAILS_ROOT}/vendor/plugins/acts_as_ferret/lib/class_methods.rb:438:in `const_get''
2006 Mar 30
4
Select List to change type of STI class
Hi: I''m trying to create a drop-down list to change the type of a Single Table Inheritance class. I tried this: <%= select :user, :type, [ [''Author'', ''Author''], [''Editor'', ''Editor''], [''Administrator'', ''Administrator''] ]
2006 Aug 16
5
New, and need help
Hey, well im new to ruby. I heard it was a web site creating software. Well the problem is that where do i get the software from? ill work out how to use it, i just need to know where to download the software. Thanks. -MAB -- Posted via http://www.ruby-forum.com/.
2006 Dec 17
1
Markaby template & layout (can't get them to work together)
Hi all, I am starting a new rails app with the Markaby plugin (had some issues installing, but think its working). First, i created an index.mab file for a controller containing: h1 "First template" That rendered fine. Also, I do not have a "def index ..." in the controller. Then I created an app/layouts/application.mab file. It didn''t get picked up until after
2006 Jan 22
2
Using register_template_handler to serve CSS files (Making ActionView handle .css as .rhtml)
Hi, I wanted to be able to use some Rails code inside CSS files, so I set up a controller (StylesController) to serve CSS files that reside inside the controller''s view folder when the browser requests /stylesheets/:action So in the controller I just define empty actions with the names I want my style sheets in (ie: def cooleffects end - that would respond to
2007 Nov 18
2
Variable inside of another variable
Hi everyone, I''m building partial and I need to use a variable inside of another variable name: I''ve tried like this: <div class="form_row"> <label for="<%= field %>"><%= field_title || field.humanize %>:</ label> <%= form.text_field field, :size => User::field.upcase_SIZE,
2012 Jul 17
3
NA instead of time stamp
I was wondering why I get <NA> instead of the timestamp in the following. Thanks. > dataDir <- file.path(wd) > localRaw <- read.csv(file.path(dataDir,"LOCAL.csv"), as.is=T,stringsAsFactors = FALSE) > localRaw[1:2,] Year Month Day hour minute second Temp1mab Temp7mab Temp14mab Salinity1mab 1 2009 10 5 0 0 0 11.288 13.675 13.743 33.513