Displaying 20 results from an estimated 40 matches for "with_opt".
Did you mean:
with_popt
2010 Oct 01
1
I18n.with_options bloc executed TWICE
Hi, to avoid putting the whole locale scope on every I18n.t call I''m
trying to use a scope, as stated in the doc
(http://guides.rubyonrails.org/active_support_core_extensions.html#with_options)
I tried with
<%= I18n.with_options :locale => :en, :scope => ''portal.visitor_menu'' do
|i18n|%>
Try <%= i18n.t :fav_songs %>
<% end %>
But it produce
Try favorite song
Try favorite song
I mean, the bloc is executed TWICE. The same code exercised u...
2007 Aug 17
0
map.with_options :path_prefix => ''
Hello,
I am getting a ''No route matches'' error in rspec with routes that have a
path_prefix composed by map.with_options. Rails recognizes the routes just
fine and the site works, but I can''t get the specs to pass unless I put the
prefix in each individual route. Any help is appreciated.
My foo model has a polymorphic owner which is what I want the path_prefix to
represent, so my routes.rb has something...
2007 Feb 07
3
Upgrade to Rails 1.2.2 : RESTful routes not working anymore
Hello,
I just upgraded my app to Rails 1.2.2.
My routes are :
map.with_options :path_prefix => "/admin", :name_prefix => "admin_" do |m|
m.resources :requests, :controller => "admin/requests", :collection => {
:destroy => :delete, :search => :post } do |request|
request.resources :histories, :path_prefix =>
&quo...
2006 Mar 23
10
Domain Requirements in Routes (Edge Rails)
I saw on the bottom of the following page that you can route requests to
different controllers based upon which subdomain is being requested.
http://wiki.rubyonrails.com/rails/pages/Routes
with_options :requirements=>{:subdomain=>''first.com''} do
map.connect '''', :controller => "first/catalog"
map.connect ''featured'', :controller => "first/catalog",
:action=>''featured''
map.conn...
2009 Dec 06
9
Route error to Admin namespace
Hi.
I have some apps that i have "admin" areas to the clients manager the app.
This "admin" is a directory on my controllers path, like this:
my_site
--> app
-->-->controllers
-->-->-->admin
And my controllers in "admin", i use the correct namespace(example for
clients_controller):
class Admin::ClientsController < AdminController
Only doing
2006 Jun 06
2
Routing Priority and Unknown Action
I have a site that consists of a blend of static and dynamic pages. The
solution I came up with uses the default routing to try to pair up a
controller and action for the dynamic stuff and, if the url doesn''t
jive, rails attempts to render the static content with a special
controller just for rendering that.
To allow the static content to use all sorts of user memorable URLs I
used
2006 May 08
0
testing named routes
Hello,
I''m trying to test routes named within a map.with_options statement.
I have in routes.rb:
map.with_options :controller => ''films'' do |f|
f.overviews ''films/:index'', :action => ''index'', :requirements => { :index => /index(artist|date|title)\.html/ }, :index => ''new...
2006 May 24
2
named routes confusion
Hi,
I''m trying generate a URL from a named route like: namedroute_url(params...)
but the generated route is always coming out as the first match from the routes table.
The named route is defined inside a map.with_options block, but that shouldn''t matter should it?
dorian
--
--
I do things for love or money
2007 May 17
2
Scoped options setting?
Is there any way to set options during the evaluation of a particular
expression, with them automatically reset when control leaves that
expression, however that happens? Kind of like "let" on a "special"
variable does in Lisp. I naively tried
with(options(warn=-1), {
fit <- fitdistr(data, 'weibull') # complains about NaNs
})
but this leaves
2007 Dec 14
2
Rails 2.0 map.namespace and path_prefix
Hi!
I''m trying set up new routing in rails 2.0 and have 1 problem
map.namespace :admin do |admin|
admin.resources :permissions, :path_prefix => ''/:lang''
end
i want have addres like this:
http://site.com/en/admin/permissions
also i tested:
map.with_options :path_prefix => ''/:lang'' do |lang|
lang.namespace :admin do |admin|
admin.resources :permissions
end
end
its still not map http://site.com/en/admin/permissions
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You re...
2006 Jul 28
11
Forum
Im making forum and i have problem with paths.
Here is code:
http://pastie.caboo.se/6389
With this code, it works. But its a bit weird to use so many paths
function. For every path i need to make new function. So can you suggest
me something.
Tables are like here:
http://wiki.rubyonrails.com/rails/pages/ForumExample
--
Posted via http://www.ruby-forum.com/.
2006 Apr 04
1
subdomain routing
According to the wiki (http://wiki.rubyonrails.org/rails/pages/Routes)
you can handle subdomain routing in routes.rb. Like this:
with_options :requirements=>{:subdomain=>''first.com''} do
map.connect '''', :controller => "first/catalog"
map.connect ''featured'', :controller => "first/catalog",
:action=>''featured''
map.conn...
2011 Jan 19
6
rake aborted! can't convert Hash into String
...by/gems/1.8/gems/activesupport-2.3.5/lib/active_support/option_merger.rb:20:in
`method_missing''
/Users/lina/ruby/trunk/config/routes.rb:58
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/object/misc.rb:78:in
`with_options''
/Users/lina/ruby/trunk/config/routes.rb:53
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:226:in
`draw''
/Users/lina/ruby/trunk/config/routes.rb:1
/System/Library/Frameworks/Ruby.fra...
2018 Dec 04
3
patch to support custom HTTP headers in download.file() and url()
...col = "http") {
+ con <- url(get_path(path, protocol), ...)
+ on.exit(try(close(con)), add = TRUE)
+ readLines(con)
+}
+
+get_path <- function(path = "anything", protocol = "http") {
+ paste0(protocol, "://", "eu.httpbin.org/", path)
+}
+
+with_options <- function(opts, expr) {
+ old <- do.call(options, as.list(opts))
+ on.exit(options(old), add = TRUE)
+ expr
+}
+
+tests <- function() {
+ cat("- User agent is still set\n")
+ with_options(list(HTTPUserAgent = "foobar"), {
+ h <- get_headers()
+ stopi...
2007 Jan 16
4
Subdomain Account Keys Best Practice
Hi all,
I''m thinking of useing sub-domains as account keys, something I''ve played
with previously.
I have accounts and users, fairly standard, except that users can belong to
many accounts, and accounts can have many users.
So I figure I need to have an area on the main domain, that allows users to
view their account memberships and things. Sort of like a dashboard for
each
2007 May 21
2
Rails'' fixtures suck! But what about something like this?
...re how I specified nested post fixtures).
- The second option is what I currently prefer: http://pastie.caboo.se/63361
In this option, I keep the one table per file concept that is
currently used. As such, we don''t need to specify what table we want
to use before hand. I make available a with_options method which lets
you set default attributes for fixtures. It''s also easy to create
loops to automatically generate fixtures, as I show in the second half
of the file. The f method is the actual method for creating a fixture.
it takes a name as a string and a block in which the attribu...
2006 Jul 27
0
Using CRUD + non-standard URLs
Hi,
Please take a look at this code:
map.with_options :controller => ''school'' do |m|
m.school_show ''e/:id'', :action => ''show''
end
map.resources :school
map.connect '':controller/:action/:id''
And then I want a school to be shown on URLs like /e/123 and sho...
2006 Jun 28
2
simply_restful plugin tests failing???
...ort/option_merger.rb:14:in
`method_missing''
vendor/plugins/simply_restful/test/routing_test.rb:61:in
`assert_restful_routes_for''
/Users/zackchandler/dev/tmp/test/config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/core_ext/object/misc.rb:28:in
`with_options''
vendor/plugins/simply_restful/test/routing_test.rb:60:in
`assert_restful_routes_for''
vendor/plugins/simply_restful/test/routing_test.rb:10:in
`test_default_restful_routes''
vendor/plugins/simply_restful/test/routing_test.rb:54:in
`with_restful_routing...
2007 Nov 07
0
Named routes raising nil.rewrite error
Hi all. I''m having a little problem with named routes. I have the
following named route:
map.with_options :controller => ''snippets'' do |map|
map.snippets
''faq/'', :action => ''index''
map.new_snippet ''faq/
new'', :action => ''n...
2007 Aug 10
0
ActiveRecordAssociationMatcher
...ly need
to put some specs together for it, but I''d appreciate any comments.
It lets you spec your associations like this:
describe Record do
include ActiveRecordAssociationMatchers
it "should belong to artist and use a counter cache" do
Record.should belong_to(:artist).with_options(:counter_cache => true)
end
it "should have_many tracks" do
Record.should
have_many(:tracks).with_class_name("Song).and_options(:include =>
:writers)
end
end
Please see my blog entry or the pastie for more details.
http://stevetooke.karmatrading.co.uk/2007/8/10...