Displaying 20 results from an estimated 400 matches similar to: "Extending rails with plugins"
2006 Jul 27
2
accessing a variable inside a plugin
Hello,
I would like to load an Hash in my init.rb plugin file ... than I would
like to use this hash in my module ...
in my init.rb:
@anHash = load From file...
in mymodule:
module Amodule
def myFunction
#@anHash ....
end
end
How can I access to my hash in my plugin module function ?
thanks for this dummy question ;-)
Arnaud
2011 Apr 08
5
How to extend a helper using plugin?
Hello,
I''m facing this problem while trying to extend the parse_redmine_links
helper method in Redmine-1.1.0 (Rails-2.3.5) from my plugin.
My idea is to use alias_method_chain so the extended version could
call the original version and adjust the result to it''s liking.
Anything I''ve tried so far exposes this behavior: the first render of
a page uses the extended
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 <
2011 May 19
1
Module in Rails
Hi,
I want to use module in Rails 3
I have module in /lib directory.
file name: my_module.rb
Code of Module:
module MyModule
def self.my_method
loop do
puts "I am started!!!"
sleep 2
end
end
end
Now, I want to use this module in my rb file resides in app_root/daemon
directory named myserver.rb
How can i use that?
--
You received this message
2011 Aug 09
3
[LLVMdev] Adding a module in a pass
I have an optimization pass (FunctionPass) where I need to add global
constructors.
For cleaness sake I decided to add these in my own module. My module
is created in my FunctionPass constructor:
MyPass()
: FunctionPass(ID),
myModule("my_module", getGlobalContext())
{}
I generate an llvm.global_ctor global variable in my module, and I add
my global constructors
2012 Sep 28
2
nested modules and autoloading
All-
I''m using puppet 2.7.14. I''ve reviewed
http://docs.puppetlabs.com/puppet/2.7/reference/modules_fundamentals.html
but it doesn''t seem to cover what I''m attempting.
Consider a module layout like this:
$ tree mymodule
mymodule
|-- Modulefile
|-- README
|-- manifests
| |-- init.pp
| |-- special_type
| | `-- prereqs.pp
| `-- special_type.pp
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 :authenticate?
def index
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 =>
2015 Feb 18
3
[LLVMdev] Calling into non-linked function via a pointer
This is my module's dump, which is different than yours. I wonder how I can
get the external thing for my function.
define double @sum(double, double) {
entry:
call void @FooBar()
%tmp = fadd double %0, %1
ret double %tmp
}
; ModuleID = 'My_Module'
define double @sum(double, double) {
entry:
call void @FooBar()
%tmp = fadd double %0, %1
ret double %tmp
}
declare void
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
<%
2008 May 21
2
Replacing ActiveRecordStore::Session with a custom model
Has anyone managed to replace ActiveRecordStore::Session with their
own model?
In the source (http://dev.rubyonrails.org/browser/trunk/actionpack/lib/
action_controller/session/active_record_store.rb) it says you can
override the default by setting
CGI::Session::ActiveRecordStore.session_class = MySessionClass
I have tried doing this in a number of ways but I get all kinds of
weird errors, as
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
2008 Aug 24
2
config.after_initialize and development mode
Hi,
I''m using activemerchant and setting up a class variable using
config.after_initialize. It works great for the first request, but
then the variable is nil.
config.after_initialize do
ActiveMerchant::Billing::Base.mode = :test
OrderTransaction.gateway =
ActiveMerchant::Billing::PaypalGateway.new(...)
end
I''m assuming this is is due to the model reloading after each
2006 Feb 24
5
Sanity Check
Maaaaaaaaaaaaajor sanity check needed.
I wrote a simple little plugin, and it wouldn''t load. I put some comments
in it''s init.rb, and it didn''t even spit those out. So, I dug into the
initializer.rb (/vendor/rails/railties/lib/initializer.rb) to see wtf is
going on, and found the problem... but... can''t explain it. Here is the
code in question:
2012 Jun 08
1
Announce: puppetlabs_spec_helper 0.1.0 Available
puppetlabs_spec_helper is a Rubygem to make writing and running module spec
tests using rspec-puppet easier. It includes a set of common rake tasks and
a spec_helper that correctly initializes puppet and rspec-puppet for
testing.
The code is available on github at
http://github.com/puppetlabs/puppetlabs_spec_helper. Patches are welcome.
To convert a module with existing spec tests to use the
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
2009 Oct 11
1
passing model data to a plugin called within that model
I am making a plugin which extends ActiveRecord::Base
I have the plugin working in my models in other aspects. I would like
to pass in some data to the plugin, but I can''t get the data I would
like.
so if I have:
class Stuff < ActiveRecord::Base
belongs_to :thing
my_plugin :id => self.thing.other_id
end
it chokes on figuring out what to do with self.thing.other_id.
2013 Jul 25
5
Heria, Facts, and Puppet
So something doesn''t look right for me when running puppet apply -e
''include ...'' for looking heria via facter fact.
I have hiera configure as this,
:backends:
- yaml
:hierarchy:
- common
- ''%{env_name}''
:yaml:
:datadir: /var/lib/hiera/data
and, a file envXX.yaml store in the datadir, and I can run *hiera xyz
2012 Nov 01
0
Lookup and scoping of hiera data from erb templates
Hey Folks.
Reading through the docs and the mailing list only helped confusing me
more, so maybe its better to just ask if my approach is correct.
Imagine a basic project structure with a module and two classes inside:
modules
|- my_module
|-frontend
|-backend
I''m using Hiera to manage dynamic values, so lets say I have:
---
backend:
foo:
bar: "boo"
baz: 42
2007 Apr 13
21
ZenTest autotest now handles RSpec, yay!
Josh Knowles http://joshknowles.com/ just let me know that ZenTest Autotest
3.50 now handles your RSpec specs.
http://blog.zenspider.com/archives/2007/04/zentest_version_350_has_been_released.html
That''s a great news.
Josh also shared with me a quick hack to make autotest work with only the
RSpec plugin installed.
Add the following into your ~/.autotest file