Displaying 20 results from an estimated 26 matches for "basecontrol".
Did you mean:
bagcontrol
2005 Dec 28
3
Module loading
I''ve looked high and low for the answer to this and can''t seem to find
anything that helps.
I have an admin section (much like Typo) where all controllers are based
on the Admin::BaseController.
My directory structure is
[RAILS]
-app
--controllers
---admin
----base_controller.rb
----products_controller.rb
Products controller is:
class Admin::ProductsController < Admin::BaseController
end
base_controller.rb is:
class Admin::BaseController
end
However I keep getting this error:
Na...
2013 Mar 20
2
Rspec + Devise + BaseController
Hello there,
I''m creating a base controller for the admin section of a project. All
controllers whitin the admin section will inherit from it.
#####################################################
#app/controllers/admins/base_controller.rb
class Admins::BaseController < ApplicationController
layout "admin_cms"
before_filter :authenticate_admin!
end
#####################################################
#spec/controllers/admins/base_controller_spec.rb
require ''spec_helper''
describe Admins::BaseController do
controller do...
2006 Aug 08
2
Extending rails with plugins
I''ve been looking at bottling some functionality up into a plugin, but I''m
having some problems including it.
The structure I have is:
/app/controllers/admin/base_controller.rb:
class Admin::BaseController > ApplicationController
#snip#
end
/vendor/plugins/myplugin/lib/my_module.rb:
module MyModule
def new_func
"New Function"
end
end
/vendor/plugins/myplugin/init.rb:
require ''my_module''
Admin::BaseController.send :include, MyModule
However, th...
2008 Aug 15
7
Autotest and subclasses / namespaces
I am writing a controller admin/cities_controller.rb
it inherits from AdminController, so it''s defined like
class Admin::CitiesController > AdminController
Whenever I save the controller file, autotest freaks out:
uninitialized constant Admin::AdminController (NameError)
I''m pretty used to just hitting CTRL-C to get autotest to re-load all
the files, or flicking to
2013 Oct 18
3
before_action - performing an action to prevent
class WebsocketController < WebsocketRails::BaseController
private
def authenticate?
unless current_user.token == message[:token]
current_redirect_to ''home/index''
false # that here we need to do to stop the further execution?
end
end
end
class WorldsController < WebsocketController
before_action :auth...
2011 Mar 30
0
Anonymous Subclass of ActionController::Base
I''m trying to spec a subclass of ActionController::Base using an
anonymous subclass but I am running into errors but I am receiving a
uninitialized constant StubResource
Here is my base class
class Admin::BaseController < ApplicationController
before_filter :etherweb_site
load_and_authorize_resource
layout "admin/admin"
protected
def etherweb_site
end
end
Spec:
require File.expand_path(File.dirname(__FILE__) + ''/../../
spec_helper'')
describe "Admin::BaseCon...
2012 Mar 07
0
LoadError: Expected X to define on gem upgrade
...am running into the
following when trying to start the app:
Expected ../app/model/store/base.rb to define Base
base.rb defines base like:
module MyApp
class Store::Base
end
end
I''ve done some digging and found that ActiveAdmin did some refactoring to derive everything from a BaseController. It also depends on another gem (InheritedResources), which does:
self.resource_class ||= begin
namespaced_classes = self.name.sub(/Controller/, '''').split(''::'')
namespaced_class = [namespaced_classes.first, namespaced_classes.last]...
2010 Apr 14
4
module/class question
Are these two below the same thing?
1. module X
module Y
class Z
2. class X::Y::Z
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
2005 Dec 29
8
First module gives "unknown action"
Hi, I''m using "Agile Web Dev. w/Rails", which is great but has a minimum
on grouping controllers into modules. I''ve successfully generated a
module scaffold, so I have:
app/controllers/admin_controller.rb
app/controllers/admin/things_controller.rb
(And the rest of the scaffold output, which seems normal.) However,
browsing to http://localhost:3000/admin/things/
2007 Aug 27
0
Want to Move RestfulAuthentication's UsersController to Admin::UsersController
...ion''s UsersController to an Admin
module--Admin::UsersController--as I''m also adding roles and
permissions for an app I''m building. I would like this all to be
within a single user interface with a standard security level required
for all these pieces as defined in Admin::BaseController.
So far, I''ve been able to view the /admin/users/new form and a list of
users I built at /admin/users/ or /admin/users/list, but if I try to
submit the /admin/users/new form, I get an error saying that the
UsersController cannot be found. Also, if I set login_required in the
Admin::Bas...
2008 Nov 11
1
Admin controller
This is very weird behavior for rails.
1. When I visit my app
http://localhost:3000/admin/base/login
class Admin::BaseController < ApplicationController
def login
render :text => "running"
end
end
2. but when I go here
http://localhost:3000/
I get error because login.html.erb not found
3. even though my route looks like this.
map.root :controller => "Admin::Base", :action => :lo...
2009 May 03
0
HTTP Auth 401 Even on Valid Login
...uest_with_http_basic keeps
failing even though I am entering the correct info.
If I try to access /admin/items/new, I enter the correct info but I
keep getting prompted.
The strange part is that when I cancel out, I get "HTTP Basic: Acce".
Here''s the controllers:
class Admin::BaseController < ApplicationController
before_filter :authenticate
def authenticate
authenticate_or_request_with_http_basic do |name, pass|
name == ''h'' && pass == ''x''
end
end
end
class Admin::ItemsController < Admin::BaseController
def...
2006 Apr 04
3
How to use in_place_editor_field ?
Hello, I really don''t understand how to use in_place_editor_field
In my controller :
class Admin::CategoriesController < Admin::BaseController
in_place_edit_for :category, :title
def list
@categories = Category.find_all
end
end
In the view list.rhtml
<% @categories.each do |c| %>
<td><%= in_place_editor_field :c, c.title %></td>
# snip
<% end %>
I get error
Called id for nil, which would...
2006 May 31
5
Sharing code between some controllers? Staying DRY
Hi,
I have four controllers: one for the store front and three for the
store admin. In each controller I have copied and pasted exactly the
same code. It is a method called redirect_to() to override Action
Controller''s redirect_to(). Copy and paste is bad. I can think of two
options but I don''t know how Rails will feel about them.
Option 1: Can I create an intermediate
2006 Mar 31
18
Modelling Foreign Keys
Can someone point me to a reference or tutorial that shows how to map
foreign key relationships in the model?
For example given:
Users
id
name
email
Posts
id
user_id
title
How do I associate user_id with users.id in the Post and User models?
has_many and belongs_to don''t seem to do it.
--
Posted via http://www.ruby-forum.com/.
2011 Apr 21
1
Rails 3 Foreign Domain routing - cannot get this to work!
...cache_domain
self.cached_domain = if self.cname_alias.blank?
"#{self.subdomain}.#{APP_CONFIG[:domain]}"
else
"#{self.cname_alias}"
end
end
[/code]
as per the example, my base controller:
[code]
# app/controllers/personalized/base_controller.rb
class Personalized::BaseController < ApplicationController
before_filter :get_project
protected
def get_project
@project = Project.first(:conditions => {
:cached_domain => request.host
})
end
end
[/code]
One thing I noticed, in PersonalizedDomain, was that if I put a debug
statement in the sel...
2006 Jan 23
1
learning how models, controllers, and views pass data
...ral, I think I still need
a broader understanding of how Views, Controllers, and Models pass
information and variables to each other.
I''m creating a site that allows for email campaigns. I have a
''create_email_controller'':
class Admin::CreateEmailController < Admin::BaseController
layout ''admin''
def index
write
render :action => ''write''
end
def write
@email = Email.new
end
def email_list
email = Email.find(:all)
email.each { |address| MailList::deliver_send_email(address) }
redirect_to (:action =>...
2008 Oct 08
0
undefined method add called for ActsAsFerret::Remote::Server
...ly to do. Please help me.
I am using active scaffold for my object. And my sample code is as
follows
class Object < ActiveRecord::Base
validates_presence_of :title, :message => "required"
#searchable fields
acts_as_ferret
end
class Admin::ObjectsController < Admin::BaseController
active_scaffold :object do |config|
# config.columns = :title, :content
config.columns = :title, :content
config.list.columns = :created_at, :title
config.create.columns = :title, :content
config.update.columns = :title,:content
# config.columns.content
end
end
I a...
2009 Aug 07
4
ActionController::UnknownAction (No action responded to 22.
I try to switch my application from Rails 2.2.2 to Rails 2.3.3.
In namespace :admin I have a resource-based controller. See controller
class Admin::OSystemsController < Admin::BaseController
def index
.......
end
def edit
.........
end
def update
..........
end
end
Resource is added to routes.rb like
map.namespace :admin do |admin|
............
admin.resources :o_systems, :only => [:index, :edit, :update]
............
end
I go to edit page (see view)
............
2011 Oct 24
1
JQuery autocomplete example
...an autocomplete and ran into a small set of problems. I''m not using
the exact names of models, but I suppose I could. It''s just a dummy
set. For me: Model is Package and attribute is Brand.
I don''t understand what the reference to class ProductsController <
Admin::BaseController has to do with anything relevant. Typically
Controllers inherit from ApplicationController. Why this is different
it not explained.
but once I get past this... I just did it anyways.
It doesn''t do anything. There''s no callbacks to the server, no
database lookups, and no v...