similar to: Custom method in Application Controller

Displaying 20 results from an estimated 1000 matches similar to: "Custom method in Application Controller"

2015 Oct 26
1
[PATCH 4/4] nouveau/debugfs: add interface for current load
On Mon, Oct 26, 2015 at 2:13 PM, Karol Herbst <nouveau at karolherbst.de> wrote: > From: Karol Herbst <git at karolherbst.de> > > --- > drm/nouveau/include/nvif/device.h | 1 + > drm/nouveau/include/nvkm/subdev/pmu.h | 10 ++++++++++ > drm/nouveau/nouveau_debugfs.c | 23 +++++++++++++++++++++++ > drm/nouveau/nvkm/subdev/pmu/base.c | 18
2012 May 28
4
How to load a selection list into the method new of a controller?
Hi friends! I''m relatively new with Rails and I''m struggling for a long time with this problem (it should have a pattern solution but until now I didn''t find it): I have the following models: Institution, City, State and Country. class Country < ActiveRecord::Base has_many :states has_many :cities, :through => :states end # == Schema Information # Table
2007 Nov 21
7
describe AddressesController, "handling GET /addresses" do
Hello, I''m working with scaffold generated controller test code for handling GET requests. Address is the model being tested. Address belongs_to Company, Company has_many addresses. In my addresses_controller I have: before_filter :get_company def index @addresses = @company.addresses.find(:all) respond_to do |format| format.html # index.html.erb format.xml {
2007 Dec 29
2
Sending methods after classifying
The following code gives me an error: class_vars = [''fruit'',''cow'',''coffee''].each do |class_var| "#{class_var}".classify.send(:find, 1 + rand(10)) end The error message stack: LocalJumpError: no block given from (irb):34:in `find'' from (irb):33:in `each'' from (irb):33:in `find''
2006 Jan 31
2
Relationship navigation issue
class Event < ActiveRecord::Base belongs_to :venue belongs_to :category end class Venue < ActiveRecord::Base belongs_to :city end class City < ActiveRecord::Base belongs_to :state end I want to retrieve all event records belonging to a state. Coming from hibernate background I tried something like this: def self.list_for_a_state(state_id) find_by_sql(["select e.*
2006 Feb 03
6
Saving a User Object while in the Address Controller
Hi, My saves are failing me and I can''t figure out why. I am trying to save an address id to a user object just after I create the address. This isn''t the exact code, but it shows what I am trying to do. class AddressesController < ApplicationController def create @address = Address.new(params[:address]) saved_address = @address.save @user =
2006 Jan 08
4
Rails table pluralizing Issue
Hi, I am working on a table with name "addresses". However when I do a ruby script/generate scaffold Address, I am not able to access http://localhost:3000/addresses. I am getting the following error. uninitialized constant Addres This error occured while loading the following files: addres.rb How do I resolve this issue. Thanks Silvy MAthews
2007 Aug 20
0
FormBuilder in rjs
I have a page, which renders a partial that contains a ''State'' drop down list. Upon change, it re-renders the ''City'' drop down, re- populating it based on selected state_id: Page: /customer/new.rhtml <% form_for :customer, :url => customers_path do |f| %> State: <%= f.collection_select :state_id, State.find(:all), ''id'',
2006 Apr 25
4
belongs_to :through
belongs_to :through Why is that not possible? We should have: Street belongs_to :city belongs_to :country, :through => :city -- Posted via http://www.ruby-forum.com/.
2007 Jun 09
11
authentication, controller specs. I think I''m missing something simple ....
Hi all, I feel like I''m missing something really easy and I''m just not seeing it. I''m using the restful_authentication plugin and have a User model. Uesr has_many :things and Thing belongs_to :user. That''s it. I did a "script/generate rspec_scaffold thing" to generate all the necessary bits. The "rake db:migrate" to create the db. At
2007 Feb 14
2
File into database migration
Hi, I am trying to figure out an approach to load in our initial data into our database. I have written some load_data migrations which populate a lot of the stuff, how some of the database items are images etc and I am trying to figure out how to approach added them to the database during a rake db:migrate I am thinking if I store the files in a folder off the RAILS_ROOT I should be able to
2006 Apr 12
22
Dynamic Select Box
Hi, I''m new to rails/ruby having come from PHP and am just starting to get my head round how easy it can be :) However, can anyone point me in the right direction for dynamicaly updating a select box based upon the choice of a previous select box, without a page refresh. Any and all help greatly appreciated. Thanks -- Posted via http://www.ruby-forum.com/.
2011 Nov 07
1
function that load variables
Dear all, I have saved few variable names into local files, I wanted to make a function that load this files and "generates" the variable names into my working environment. I have tried to do that as a function but my problem is  that this function does not return the variable names load_data<-function(path,Reload=FALSE){     if (Reload==TRUE){            print("Loading
2015 Oct 26
0
[PATCH 4/4] nouveau/debugfs: add interface for current load
From: Karol Herbst <git at karolherbst.de> --- drm/nouveau/include/nvif/device.h | 1 + drm/nouveau/include/nvkm/subdev/pmu.h | 10 ++++++++++ drm/nouveau/nouveau_debugfs.c | 23 +++++++++++++++++++++++ drm/nouveau/nvkm/subdev/pmu/base.c | 18 ++++++++++++++++++ 4 files changed, 52 insertions(+) diff --git a/drm/nouveau/include/nvif/device.h
2015 Oct 26
0
[PATCH v2 4/4] nouveau/debugfs: add interface for current load
From: Karol Herbst <git at karolherbst.de> v2: optimize macro and fixed data array type --- drm/nouveau/include/nvif/device.h | 1 + drm/nouveau/include/nvkm/subdev/pmu.h | 10 ++++++++++ drm/nouveau/nouveau_debugfs.c | 23 +++++++++++++++++++++++ drm/nouveau/nvkm/subdev/pmu/base.c | 18 ++++++++++++++++++ 4 files changed, 52 insertions(+) diff --git
2015 Oct 26
0
[PATCH v3 4/4] nouveau/debugfs: add interface for current load
From: Karol Herbst <git at karolherbst.de> v2: optimize macro and fixed data array type v3: fix bug I added in the last version --- drm/nouveau/include/nvif/device.h | 1 + drm/nouveau/include/nvkm/subdev/pmu.h | 10 ++++++++++ drm/nouveau/nouveau_debugfs.c | 23 +++++++++++++++++++++++ drm/nouveau/nvkm/subdev/pmu/base.c | 18 ++++++++++++++++++ 4 files changed, 52
2010 Sep 10
10
current_page? inside controller
Is there any easy way of using something like current_page? method from ActionView::Helpers::UrlHelper inside controller ? I have routing like: resources :addresses resources :mailing_addresses, :controller => ''addresses'' And I would like to do a check in my controller that would look like this: class AddressesController def index if current_page?(live_addresses_path)
2013 Apr 02
4
gmaps4rails: undefined method `model_name' for NilClass:Class
Hi All, just in a spot of bother with this gem, I am trying to create a new location and get the above msg. here is my controller: class LocationsController < ApplicationController # GET /locations # GET /locations.json def index @locations = Location.all @json = Location.all.to_gmaps4rails end respond_to do |format| format.html # index.html.erb
2006 Apr 04
4
Find records based on associated table''s colums
Hello, Let''s say I have a model for a "house". Each house has_a "city", which in turn has_a "state" which in turn has_a "country". The objective is to retrieve all houses in a given state, say "Massachusetts". Being new to Ruby on Rails what I like is that things that should be simple usually are simple, and since we have easy access to
2008 Jul 07
1
Non model cascading selects
In my model I have a city_id. ON the form I am using a cascading select to select the state, which then does a remote_submit to get the list of cities (and hence the city_id) for the selected state. The problem that I am having is that if I make a selection, hit SUBMIT and validation fails, the original selected state/city is now reset (ie, the values aren''t saved). Since they