Displaying 20 results from an estimated 100 matches similar to: "RSpec and resource_controller plugin"
2008 Mar 16
3
undefined method `redirect_to'
Hi all. I''m getting the following error in my app:
undefined method `redirect_to'' for ActionController::Base:Class
I''m using Windows 2000, Rails 2.0.2 and resource_controller (from
James Golick).
My controller:
class CommentsController < ApplicationController
include ResourceController::Controller
belongs_to :post, :article, :photo
create do
2008 Apr 24
3
DRYing up controllers
Hi
I''m a big fan of plugins such as Resource Controller
http://jamesgolick.com/2007/10/19/introducing-resource_controller-focus-on-what-makes-your-controller-special
However, recently decided I don''t want to depend on a plugin for this,
and would rather stick closer to the rails core.
So does anyone have any cool strategies or ideas for achieving this?
Or is there any move to
2012 Oct 18
0
unexpected return (LocalJumpError) only when executing this code within autoloaded classes?
Posted on stackoverflow but no traction yet:
http://stackoverflow.com/questions/12942505/why-does-using-set-trace-func-work-in-some-places-but-cause-unexpected-return-l
The following is a generified part of the code in a gem I''m working on:
module SomeModule
class << self
attr_accessor :procedure
def log_events(*args)
args.flatten!
2008 Dec 19
3
Recommended way of restricting action permissions?
Hi, I just have a "best practices" question. I''d like to block users
that don''t own a particular resource from performing edit/update/
destroy actions on it. Here''s how I currently do it:
## User has many resources, of different types
------- resource_controller.rb -------
before_filter :require_ownership, :only => [:edit, :update, :destroy]
... public
2007 Dec 18
2
rpec_scaffold and nested resources
I''ve got a love-hate relationship with script/generate rspec_scaffold
If you are using non-nested controllers/resources it''s great. I love
the spec skeletons it generates.
But I find myself doing this, where Y is and existing set of
model/controller ... representing a resource:
1) script/generate rspec_scaffold x ....
At this point rake spec passes.
2) edit config/routes.rb
2010 Jan 25
9
skinny Controllers, fat models with REST?
Hi,
I''m really new to rails, so i programmed some stuff and today i read
some things about skinny Controllers, fat models.
My Controllers are really fat now. So i''m asking myself how can i
shrink my controllers and move the code to the models, especially in
fact of REST e.g. in focus on error codes?
code example:
# POST /tasks
# POST /tasks.xml
def create
@authorized
2008 Jun 12
1
map.resources :foo_items, :as => :foo confusing my controller specs
I have following resource defined in my config/routes.rb (the model
name is contrived)
map.resources :foo_items, :as => :foo
that I originally generated with rspec_scaffold:
ruby script/generate rspec_scaffold foo_item
but when I use the :as attribute in resources to make the URI path be
''/foo'' instead of ''/foo_items'' the default/generated controller
2010 Dec 20
4
Subselection by URL
Hey guys,
I''m quite new in RoR, so please excuse me when I may ask weird
questions.
I am working on a database frontend. The layout looks mostly like
a has_many bs
b has_many cs
c has_many ds
and so on. Now I want to do some selection. Maybe I want to see all ds
belonging to a specific b. I would like to do it like:
http://my.host/bs/1/ds
When I click around there (add new ds, show a d
2007 Dec 27
6
ActiveResource and (polymorphic) associations
Hi,
I''m just playing with ActiveResource and I did''nt find anything about
the support of (polymorphic) associations.
Is there a support at all?
Thanks in advance
--~--~---------~--~----~------------~-------~--~----~
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
2007 Jul 26
5
Coding standards and whitespace
Recently as a result of using Git I''ve noticed a number of
inconsistencies in the RSpec codebase with respect to whitespace
(mixed line endings, mixed use of spaces and tabs for indentation,
and trailing whitespace at the end of lines). I never would have
noticed, but Git produces nice colorized diff output which highlights
these kinds of inconsistencies.
I wanted to ask if the
2007 Mar 24
0
Using spec fixtures with integration tests
Hi all,
How can I use spec fixtures with rails integration tests ?
I''ve tried adding {{ fixtures "../../spec/fixtures/myfixture" }}
to the integration test but the fixtures are not loaded when I run the
rake task.
Rails doesn''t load symlinked fixtures either so I copied the files from
spec/fixtures for the time being. Not very DRY.
Any ideas ?
Keith
2008 May 13
3
Winecfg and users
Winecfg contains potentially harmful configuration parameters (like native overrides) and are shown in the same way as useful configuration parameters like windows version or virtual desktop.
Maybe creating a box where a user can select it's level of knowledge in wine and hide part of the interface accordingly.
It could also be used to show warning informations when changing this level for
2012 Oct 17
2
autolog: set_trace_func without all the typing
If it helps anyone developing Rails, apps, or gems, I wrote a shortcut for
set_trace_func, so next time you want to just add a line before and after
some function you are trying to debug you can have Ruby temporarily output
every line, method, etc. executed. Also, it lets you define the format, use
other loggers, etc. via a proc/lambda define, since you might not like the
default format.
2010 Nov 30
2
Did I miss a meeting?!
I''ve just stumbled (literally, while I was trying to fix a glitch I
was having after upgrading Aegis...) on the Inherited Resources gem...
why did no-one tell me?! ;-)
Is everyone else using some form of controller base-class? Am I the
last on this bus!
https://github.com/josevalim/inherited_resources
--
You received this message because you are subscribed to the Google Groups
2008 Oct 31
10
Strange dependency error after going Ruby1.8.6, Rails 2.1.0 -> Ruby1.8.7, Rails 2.1.2
Hi,
I''m getting an error I just can''t find any cause for.
The error is "A copy of ApplicationHelper has been removed from the
module tree but is still active!" and gets thrown
in a Template that uses a method defined in my ApplicationHelper. The
error occurs only in development mode.
The error did not occur before my switch to Ruby 1.8.7 and Rails 2.1.2
minutes ago.
I
2007 Jul 26
2
rspec_resource error
First of all hi, I''m new to the list, and rather new to rspec as will
probably show in myquestion.
I have tried installing rspec and rspec_on_rails as plugs both using
"script/install" and
"piston import" commands using the "current release install instructions"
here [1]. However,
there doesn''t seem to be any mention of the rspec_resource
2007 Jul 26
0
rspec_on_rails magical incantations
I ran into something really puzzling today. I don''t know exactly why
it''s happening, but I thought I''d share my experiences.
I started a dummy app just to test an idea outside of the context of
my real work today. So, I quickly get things started:
* rails junk
* cd junk
* ruby script/plugin install svn://rubyforge.org/var/svn/rspec/tags/
CURRENT/rspec
* ruby
2008 Jan 16
2
rspec_on_rails_matchers
All,
Sorry for spamming this list about this but I think everyone who could
help me with this problem is on this list... If there is a better place
to post this question let me know.
Anyways, I am trying to use rspec_on_rails_matchers in my rails app to
improve my view specs but I can''t get them to work. The helpers for the
form tags never seem to be called.
I created a new Rails
2008 Oct 09
1
About received unexpected message :code with (no args)
I use rspec_scaffold to generate a part of examples as below:
it "should expose a newly created awarding_body as @awarding_body" do
AwardingBody.should_receive(:new).with({''these'' =>
''params''}).and_return(mock_awarding_body(:save => true))
post :create, :awarding_body => {:these => ''params''}
2008 Dec 17
1
My first rspec reports "undefined method `key?' for #<String:0x46b1df0>"
this my first rspec test, it is very simple
-----------------------------------------------------------------------------------------------------------------------------------------
>
require File.expand_path(File.dirname(__FILE__) + ''/../spec_helper'')
describe Doc do
fixtures :docs
before(:each) do
@doc=docs(:yjn_bjy)
end
it "should create a new instance