Ruby on Rails Wednesday, August 31, 2011

I do like Conrad said and the code works well.
Thx ;D

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

On a hunch, I rolled back to 0.9.4 and it worked on Joyent.

Walter

On Aug 31, 2011, at 4:16 PM, Walter Lee Davis wrote:

> I am trying out Dragonfly 0.9.5 in a Rails 3.0.10 application, and
> it works really well on my Mac, but there's a problem on my Joyent
> SmartMachine.
>
> @image.file.thumb('60x60').url -> works on both
> @image.file.thumb('60x60#').url -> works on my Mac, but fails on the
> SmartMachine.
>
> The SmartMachine has ImageMagick 6.6.6-5, and Rmagick 1.6.8.
>
> My Mac has ImageMagick 6.6.4-10 and no Rmagick.
>
> So I'm not sure where to start with this. The issue crops up when I
> try to pass the crop command to the converter with the # flag in the
> geometry. I can use the > or < flags without trouble.
>
> Any thoughts? Ringing any bells for anyone?
>
> Thanks,
>
> Walter
>
>
> --
> 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@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
> .
>

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Conrad Taylor wrote in post #1019461:
> On Wed, Aug 31, 2011 at 12:01 PM, Conrad Taylor <conradwt@gmail.com>
> wrote:
>
>>> I read that, and I don't see how applying a regex to the id will help.
>>
>> match '/:id' => 'users#show', :constraints => { :id => /[0-9]+/ }
>>
>
> A much better regular expression which matches a value of an :id should
> be
> something like the following:
>
> match '/:id' => 'users#show', :constraints => { :id => /^[1-9]\d*/ }
>

There are still a couple problems with that regex:

1) There is no ending anchor so an id of '10A' would match.
2) You can't use anchors in a regexp for a constraint anyway.


This works for me:


class UserShowConstraint
def matches?(request)
dirname, id = File.split(request.path)
return false unless dirname == '/users'

id =~ /
\A #start of string
[1-9] #not 0
\d* #one or more digits, including 0
\z

Ruby on Rails

I am trying out Dragonfly 0.9.5 in a Rails 3.0.10 application, and it
works really well on my Mac, but there's a problem on my Joyent
SmartMachine.

@image.file.thumb('60x60').url -> works on both
@image.file.thumb('60x60#').url -> works on my Mac, but fails on the
SmartMachine.

The SmartMachine has ImageMagick 6.6.6-5, and Rmagick 1.6.8.

My Mac has ImageMagick 6.6.4-10 and no Rmagick.

So I'm not sure where to start with this. The issue crops up when I
try to pass the crop command to the converter with the # flag in the
geometry. I can use the > or < flags without trouble.

Any thoughts? Ringing any bells for anyone?

Thanks,

Walter


--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Tim Shaffer wrote in post #1019291:
> Give this a whirl:
>
> resources :oker_training, :path => '/oker-training'

wow... that worked, and I have no clue why I didn't try using path....

Thanks! Time to go clean up all of my routes files (yes, I have more
than 1 >_< )


~Jeremy

--
Posted via http://www.ruby-forum.com/.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

On Wed, Aug 31, 2011 at 12:01 PM, Conrad Taylor <conradwt@gmail.com> wrote:

On Wed, Aug 31, 2011 at 7:51 AM, 7stud -- <lists@ruby-forum.com> wrote:
Conrad Taylor wrote in post #1019393:
> On Wed, Aug 31, 2011 at 7:04 AM, Bruno Meira <goesmeira@gmail.com>
> wrote:
>
>>
> Bruno, I would recommend reading section 4.2 of the Rails routing guide:
>

I read that, and I don't see how applying a regex to the id will help.
How about adding :show to the :except clause and doing this:

match '/:id' => 'users/show'
resources :users, :except=>[:destroy, :show]


If you apply the regex to the :id, then one can restrict the value of 
the :id to one or more digits.  In the above, :id is simply a placeholder
and can accept any value.  Thus, the following should work for the
original poster:

match '/:id' => 'users#show', :constraints => { :id => /[0-9]+/ }

A much better regular expression which matches a value of an :id should be something like the following:

match '/:id' => 'users#show', :constraints => { :id => /^[1-9]\d*/ }

Note:  The above says that I have at least one digit >= 1 starting with the first digit.

-Conrad
 

resources :users, :except=> [ :destroy, :show ]
 
Good luck,

-Conrad

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.



--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I tried a named route and I get this:

undefined local variable or method `dashboard_sidebar_path'

any idea?

--
Posted via http://www.ruby-forum.com/.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

On Wed, Aug 31, 2011 at 7:51 AM, 7stud -- <lists@ruby-forum.com> wrote:

Conrad Taylor wrote in post #1019393:
> On Wed, Aug 31, 2011 at 7:04 AM, Bruno Meira <goesmeira@gmail.com>
> wrote:
>
>>
> Bruno, I would recommend reading section 4.2 of the Rails routing guide:
>

I read that, and I don't see how applying a regex to the id will help.
How about adding :show to the :except clause and doing this:

match '/:id' => 'users/show'
resources :users, :except=>[:destroy, :show]


If you apply the regex to the :id, then one can restrict the value of 
the :id to one or more digits.  In the above, :id is simply a placeholder
and can accept any value.  Thus, the following should work for the
original poster:

match '/:id' => 'users#show', :constraints => { :id => /[0-9]+/ }
resources :users, :except=> [ :destroy, :show ]

Good luck,

-Conrad

--
Posted via http://www.ruby-forum.com/.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.


--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Hello,

we are creating educational program and levels (Junior, Middle, Senior) for Rails. What do you think about it? http://bit.ly/niCP07

Sincerely,
Pavel

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/LSP7Wh3NTa0J.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

That sounds horrible. I'm seeing this occur on every page load, not
just the first one.

On Aug 31, 2:26 pm, Martin Wawrusch <mar...@wawrusch.com> wrote:
> Consider yourself lucky, I had to deal with 5 mins on first load recently.
> Take a  look at the rails-dev-tweaks gem, it helps a lot. In addition to
> that make sure that you don't autoload all the models if you use mongoid.
>
>
>
>
>
>
>
> On Wed, Aug 31, 2011 at 11:21 AM, Josh <josh.m.sha...@gmail.com> wrote:
> > I understand the difference between dev and prod.
>
> > The issue here is that in 3.0, a dev page load took half a second or
> > less.  It now takes upwards of 5 seconds.
>
> > On Aug 31, 2:15 pm, Dieter Lunn <coder2...@gmail.com> wrote:
> > > In development it recompiles with every reload. In production it only
> > > compiles when the files change and serves up the cached version
> > > otherwise.
>
> > > Dieter Lunnhttp://ubiety.ca
>
> > > On Wed, Aug 31, 2011 at 1:12 PM, Josh <josh.m.sha...@gmail.com> wrote:
> > > > With the release of 3.1, it seems that things have drastically changed
> > > > in the development workflow.
>
> > > > With the asset pipeline enabled, and the likes of this in my layouts:
>
> > > > = stylesheet_link_tag 'application', :debug => Rails.env.development?
> > > > = javascript_include_tag 'application', :debug =>
> > > > Rails.env.development?
>
> > > > ...every single css, js and image gets re-compiled on every single
> > > > request.  This takes forever.
>
> > > > My dev log is mostly comprised of this:
>
> > > > Started GET "/assets/jquery-ui-1.8.16.custom.css?body=1" for 127.0.0.1
> > > > at 2011-08-31 14:04:04 -0400
> > > > Served asset /jquery-ui-1.8.16.custom.css - 304 Not Modified (0ms)
>
> > > > It seems to me that the dev rails server (both webrick, and
> > > > passenger), is handling the request of every asset.  It didn't work
> > > > this way in 3.0.x. While it clearly says 304 (0ms) I can attest that
> > > > the overall time to process a page (and all its assets) is
> > > > *significantly* longer.
>
> > > > Here's my application.rb and development.rb - they're basically the
> > > > 3.1 defaults.
>
> > > >http://stackoverflow.com/questions/7248911/rails-3-1-force-developmen.
> > ..
>
> > > > So is there a solution here?  Even if I didn't have :debug => true in
> > > > my javascript/stylesheet tag, the JS and CSS files would still have to
> > > > be complied/generated as well as every image - which is still a
> > > > significant regression.
>
> > > > --
> > > > 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@googlegroups.com
> > .
> > > > To unsubscribe from this group, send email to
> > rubyonrails-talk+unsubscribe@googlegroups.com.
> > > > For more options, visit this group athttp://
> > groups.google.com/group/rubyonrails-talk?hl=en.
>
> > --
> > 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@googlegroups.com.
> > To unsubscribe from this group, send email to
> > rubyonrails-talk+unsubscribe@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/rubyonrails-talk?hl=en.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Consider yourself lucky, I had to deal with 5 mins on first load recently. Take a  look at the rails-dev-tweaks gem, it helps a lot. In addition to that make sure that you don't autoload all the models if you use mongoid.



On Wed, Aug 31, 2011 at 11:21 AM, Josh <josh.m.sharpe@gmail.com> wrote:
I understand the difference between dev and prod.

The issue here is that in 3.0, a dev page load took half a second or
less.  It now takes upwards of 5 seconds.

On Aug 31, 2:15 pm, Dieter Lunn <coder2...@gmail.com> wrote:
> In development it recompiles with every reload. In production it only
> compiles when the files change and serves up the cached version
> otherwise.
>
> Dieter Lunnhttp://ubiety.ca
>
>
>
>
>
>
>
> On Wed, Aug 31, 2011 at 1:12 PM, Josh <josh.m.sha...@gmail.com> wrote:
> > With the release of 3.1, it seems that things have drastically changed
> > in the development workflow.
>
> > With the asset pipeline enabled, and the likes of this in my layouts:
>
> > = stylesheet_link_tag 'application', :debug => Rails.env.development?
> > = javascript_include_tag 'application', :debug =>
> > Rails.env.development?
>
> > ...every single css, js and image gets re-compiled on every single
> > request.  This takes forever.
>
> > My dev log is mostly comprised of this:
>
> > Started GET "/assets/jquery-ui-1.8.16.custom.css?body=1" for 127.0.0.1
> > at 2011-08-31 14:04:04 -0400
> > Served asset /jquery-ui-1.8.16.custom.css - 304 Not Modified (0ms)
>
> > It seems to me that the dev rails server (both webrick, and
> > passenger), is handling the request of every asset.  It didn't work
> > this way in 3.0.x. While it clearly says 304 (0ms) I can attest that
> > the overall time to process a page (and all its assets) is
> > *significantly* longer.
>
> > Here's my application.rb and development.rb - they're basically the
> > 3.1 defaults.
>
> >http://stackoverflow.com/questions/7248911/rails-3-1-force-developmen...
>
> > So is there a solution here?  Even if I didn't have :debug => true in
> > my javascript/stylesheet tag, the JS and CSS files would still have to
> > be complied/generated as well as every image - which is still a
> > significant regression.
>
> > --
> > 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@googlegroups.com.
> > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.



--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Jim ruther Nill wrote in post #1019405:
> On Wed, Aug 31, 2011 at 10:51 PM, 7stud -- <lists@ruby-forum.com> wrote:
>
>>
>> match '/:id' => 'users/show'
>>
>
> having this line will match any controller's index action


Ah, I see. :id will match anything, e.g.

/dog
/frog
/users
/pages
/hello_world
/1
/200

> in the Segments Constraints section of the rails guide, you'll see the
> first
> line of code.
> following that code, you can use
>
> match 'users/:id' => 'users#show', :constraints => { :id => /\d/ }, :

..and the constraint there says to only match a number in the :id
position of the url. But is that route any different than the show
route created by resources()? It was my understanding that the op
wanted a url consisting of only a number, so I think the route should be
more like:

match '/:id' => users#show, :constraints => {:id => /\d+/}, :via =>
'get'


> via => :get
>
> the via option is important so that it will only match get requests.
>

I wonder why people post ambiguous questions and expect people who read
them to know what they are thinking--instead of giving a simple example
that leaves nothing in doubt.


However, that will still match routes like:

/a2b


It looks like you can write a custom matcher pretty easily, like this:


class UserShowConstraint
def matches?(request)

request.path =~ /
\A #start of string
\/ #forward slash
\d+ #one or more digits
\z

Ruby on Rails

I understand the difference between dev and prod.

The issue here is that in 3.0, a dev page load took half a second or
less. It now takes upwards of 5 seconds.

On Aug 31, 2:15 pm, Dieter Lunn <coder2...@gmail.com> wrote:
> In development it recompiles with every reload. In production it only
> compiles when the files change and serves up the cached version
> otherwise.
>
> Dieter Lunnhttp://ubiety.ca
>
>
>
>
>
>
>
> On Wed, Aug 31, 2011 at 1:12 PM, Josh <josh.m.sha...@gmail.com> wrote:
> > With the release of 3.1, it seems that things have drastically changed
> > in the development workflow.
>
> > With the asset pipeline enabled, and the likes of this in my layouts:
>
> > = stylesheet_link_tag 'application', :debug => Rails.env.development?
> > = javascript_include_tag 'application', :debug =>
> > Rails.env.development?
>
> > ...every single css, js and image gets re-compiled on every single
> > request.  This takes forever.
>
> > My dev log is mostly comprised of this:
>
> > Started GET "/assets/jquery-ui-1.8.16.custom.css?body=1" for 127.0.0.1
> > at 2011-08-31 14:04:04 -0400
> > Served asset /jquery-ui-1.8.16.custom.css - 304 Not Modified (0ms)
>
> > It seems to me that the dev rails server (both webrick, and
> > passenger), is handling the request of every asset.  It didn't work
> > this way in 3.0.x. While it clearly says 304 (0ms) I can attest that
> > the overall time to process a page (and all its assets) is
> > *significantly* longer.
>
> > Here's my application.rb and development.rb - they're basically the
> > 3.1 defaults.
>
> >http://stackoverflow.com/questions/7248911/rails-3-1-force-developmen...
>
> > So is there a solution here?  Even if I didn't have :debug => true in
> > my javascript/stylesheet tag, the JS and CSS files would still have to
> > be complied/generated as well as every image - which is still a
> > significant regression.
>
> > --
> > 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@googlegroups.com.
> > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

In development it recompiles with every reload. In production it only
compiles when the files change and serves up the cached version
otherwise.

Dieter Lunn
http://ubiety.ca

On Wed, Aug 31, 2011 at 1:12 PM, Josh <josh.m.sharpe@gmail.com> wrote:
> With the release of 3.1, it seems that things have drastically changed
> in the development workflow.
>
> With the asset pipeline enabled, and the likes of this in my layouts:
>
> = stylesheet_link_tag 'application', :debug => Rails.env.development?
> = javascript_include_tag 'application', :debug =>
> Rails.env.development?
>
> ...every single css, js and image gets re-compiled on every single
> request.  This takes forever.
>
> My dev log is mostly comprised of this:
>
> Started GET "/assets/jquery-ui-1.8.16.custom.css?body=1" for 127.0.0.1
> at 2011-08-31 14:04:04 -0400
> Served asset /jquery-ui-1.8.16.custom.css - 304 Not Modified (0ms)
>
> It seems to me that the dev rails server (both webrick, and
> passenger), is handling the request of every asset.  It didn't work
> this way in 3.0.x. While it clearly says 304 (0ms) I can attest that
> the overall time to process a page (and all its assets) is
> *significantly* longer.
>
> Here's my application.rb and development.rb - they're basically the
> 3.1 defaults.
>
> http://stackoverflow.com/questions/7248911/rails-3-1-force-development-assets-to-get-served-up-like-they-were-in-3-0-x
>
> So is there a solution here?  Even if I didn't have :debug => true in
> my javascript/stylesheet tag, the JS and CSS files would still have to
> be complied/generated as well as every image - which is still a
> significant regression.
>
> --
> 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@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

With the release of 3.1, it seems that things have drastically changed
in the development workflow.

With the asset pipeline enabled, and the likes of this in my layouts:

= stylesheet_link_tag 'application', :debug => Rails.env.development?
= javascript_include_tag 'application', :debug =>
Rails.env.development?

...every single css, js and image gets re-compiled on every single
request. This takes forever.

My dev log is mostly comprised of this:

Started GET "/assets/jquery-ui-1.8.16.custom.css?body=1" for 127.0.0.1
at 2011-08-31 14:04:04 -0400
Served asset /jquery-ui-1.8.16.custom.css - 304 Not Modified (0ms)

It seems to me that the dev rails server (both webrick, and
passenger), is handling the request of every asset. It didn't work
this way in 3.0.x. While it clearly says 304 (0ms) I can attest that
the overall time to process a page (and all its assets) is
*significantly* longer.

Here's my application.rb and development.rb - they're basically the
3.1 defaults.

http://stackoverflow.com/questions/7248911/rails-3-1-force-development-assets-to-get-served-up-like-they-were-in-3-0-x

So is there a solution here? Even if I didn't have :debug => true in
my javascript/stylesheet tag, the JS and CSS files would still have to
be complied/generated as well as every image - which is still a
significant regression.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I tried this:

scope :path => '/dashboard', :name_prefix => "dashboard_", :path_prefix
=> "dashboard", :controller => :dashboard do
match '/sidebar.:format' => :sidebar
match '/charts.:format' => :charts
match '/action_items.:format' => :action_items
match '/performance.:format' => :performance
end

not sure yet if it is going to give me dashboard_sidebar_url, for
example, as a route helper.

--
Posted via http://www.ruby-forum.com/.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Hey all,

Rails guide doesnt cover with_options in Rails 3:

http://guides.rubyonrails.org/routing.html

The book The Rails 3 Way makes no reference to with_options except for
one page briefly.

And I cannot find a decent tutorial to cover what I am trying to do.

I have this:

map.with_options :name_prefix => "dashboard_", :path_prefix =>
"dashboard", :controller => "dashboard" do |dashboard|
dashboard.sidebar ".:format"
dashboard.charts ".:format"
dashboard.action_items ".:format"
dashboard.performance ".:format"
dashboard.site_menu ".:format"
dashboard.quick_links ".:format"
dashboard.perf_randomizations ".:format"
end

Basically all of these methods "sidebar", "charts", etc are all methods
of the dashboard controller. I want them all to have a path helper of
dashboard_#{action}_url, where action is the action (e.g.
dashboard_sidebar_url). I want them all to be able to respond to both
html format and json. However, I dont know how to do this in Rails 3.

The above code raises exception:

config/routes.rb:7:in `block in <top (required)>': undefined local
variable or method `map' for
#<ActionDispatch::Routing::Mapper:0x00000102ca3570> (NameError)


Some stackoverflow posts show similar situations but not specifically
what I am trying to do here.

thanks for response

--
Posted via http://www.ruby-forum.com/.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I've just upgraded my application to Rails 3.1. I have a fairly
complex JavaScript codebase and have opted to concatenate it into a
single .js.coffee file to be compiled by Sprockets. Every so often,
I'll make changes to one of my CoffeeScript files, refresh the page,
and notice my changes weren't reflected. Looking at the Chrome
debugger, I notice the files aren't being read from the server (the
'Network' tab shows '(from cache)' on the corresponding files). This
seems to happen at random, which makes it very, very frustrating to
develop. The only solutions I've found are to clear the browser cache
or restart the browser.

Any ideas? I've tried turning :debug on in my javascript_include_tag
calls, but was getting the same results. In fact, when I had multiple
<script> tags, it seemed that the only assets returning '(from cache)'
were those I had changed! That's some irony right there.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

you were splitting after you saved the model - you want to do that before - or better use a before save call back on the model to split before the model is stored

On Aug 30, 2011 3:28 PM, "Leo M." <lists@ruby-forum.com> wrote:
> Hello!
>
> I'm developing a classical Blog like app, and I'm having some kind of
> issues about posts' tags, because I've correctly installed
> acts_as_taggable and acts_as_taggable_on_steroids gems but none of them
> work, for a controller's mismatch error (due to a Post's tags:string
> attribute I guess), but still, this is not important.
>
> What I want to do is a Blogspot's like schema, so basically there is the
> http://website/search/label/***TAG_NAME*** url, which contains all the
> posts done with this specific tag.
> Well then, I've split the tags and each tag redirect to the correct url,
> which contains all the posts made with the related tag, BUT I just
> manually created the routes and templates.
>
> The problem is : how could I tell to the controller to create an action,
> or a method with the same name of those tags inside the Search
> controller? I was thinking to a Proc, but I have no clue about how to
> structure it. Could you help me?
>
> And also, when I create a new Post, if I write in tags' text_field
> something like "wood,fire", Rails will save the string as a single tag,
> but what I evidently want is to .split(',') this string.
> Yet, I'm not able to find the place in between f.submit and the
> PostsController, where the tags would be sent to the Controller already
> split up.
> Cos, if I put the split after the :
>
> if @post.save
> @post.tags.split(',')
>
> ...in the console I get:
>
>>>Post.last
> => [ #etc etc. tags : "wood,fire"]
>
> and it isn't split. Otherwise, if I put the .split(',') method somewhere
> into the _form I get errors.
>
> So, basically I'm looking for the "place" in the middle between the
> submit action and the Controller's final check. Any idea??? :)
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> 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@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
>

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

thanks for responses

--
Posted via http://www.ruby-forum.com/.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails


@Curtis Schofield: The customer is asking for more than just changes to
the CSS -- he wants different content and some additional views.  And I
agree that this could become a nightmare -- I plan to maintain a bill of
materials, SKUs and ECOs for each variant of the app.  That should help
some.


that will help you recoup costs - it will not help you maintain and scale your codebase - you are going to create yourself a nightmare the direction you are heading. 

I know it seems like Git can do this - but this is not what Git is for this is what software is for - skip to making new and
original mistakes - don't make the obviously avoidable ones.

 - see the following.

As far as running a biz around this :


As far as software patterns:

Check out the work on 'feature flags' 


--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Hi All,
Thanks for answer my question.
I read http://guides.rubyonrails.org/routing.html#segment-constraints
and I guess that the best way to resolve my problem is do like Jim
said, put the route in match and add except constraint in resource.
Thanks All ;D

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

No.


It is free for basic usage...

On Wed, Aug 31, 2011 at 8:59 AM, Rolando <rgarro@gmail.com> wrote:
Hi:

I've been trying to get a very simple app running on godaddy
Do you think using godaddy for rails hosting is a good idea?

Thanks

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.




--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Hi:

I've been trying to get a very simple app running on godaddy
Do you think using godaddy for rails hosting is a good idea?

Thanks

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

In your opinion, what does :path do in this line:

gem 'rmagick-2.12.0-x86-mswin32', '2.12.0', :path => 'c:/sites/

--
Posted via http://www.ruby-forum.com/.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I think I understand that only belongs_to association can be
polymorphic. The model that carries belongs_to gets the foreign key
and :polymorphic => true.

But I want to model the following:

A User "has_one" vehicle, which can be either a "Car" or a "Truck",
but not both (this is a requirement). My natural inclination is toward
declaring it thus:

class User < ActiveRecord::Base
has_one :vehicle
end

class Vehicle < ActiveRecord::Base
belongs_to :user
end

class Car < Vehicle
attr_accessible :capacity # no. of passengers it can carry
end

class Truck < Vehicle
attr_accessible :horse_power # 150, 200, 250 ...
end

My goal is to be able to have foreign key in the :cars and :trucks
tables in the form of user_id and have no :vehicles table. I of course
want the association methods to work the way they do in class has_one
-- belongs_to combo, i.e. I should be able to do @user.vehicle to mean
either nil or car or truck that user owns, @car.user to be the user
owning that car etc.

I think these expectations are wrong. For instance, since I declared
Vehicle to be an AR model, I need to have :vehicles table. Period. But
when I am modeling the abstractions, I don't need any persistence for
(abstract) Vehicle. I just need to persist either a car or a truck for
a user. Thus, :users table just contains the info relevant to the user
whereas the :cars and :trucks table contains car- and truck-relevant
info along with a user_id foreign key.

Another problem I see with my expectations is that both Car and Truck
must declare belongs_to :user. Period. I am willing to do that, but my
expectation is that since Car is a Vehicle, the belongs_to association
should be inherited by the Car.

Can someone please help me see things more clearly and work around the
issues so that I can capture my relationship succinctly?

Best Regards,
Kedar

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

On Aug 31, 1:42 pm, Alexie Drobyazko <droba...@gmail.com> wrote:
> I have:
>
> Windows XP Professional SP3
> Ruby 1.8.7
> Rails 3.0.10
> Bundler 1.0.15
> ImageMagick 6.5.6 Q8
> Rmagick 2.12.9
>
> My gemfile:
>
> gem 'rmagick-2.12.0-x86-mswin32', '2.12.0', :path => 'c:/sites/
> uplodify/vendor'

Well you're telling bundler that your rmagick gem is in 'c:/sites/
uplodify/vendor'
but from what you've written below it seems like it's in the normal
location. Have you tried removing the path option ?

Fred

>
> My controller:
>
> require 'RMagick'
>
> Here I have installed my rmagick gem:
>
> c:/ruby/ruby187/lib/ruby/gems/1.8/gems/rmagick-2.12.0-x86-mswin32/
>
> But when I launch the controller, there is a message:
>
> no such file to load -- RMagick
>
> Then, I change require 'RMagick' to require 'c:/ruby/ruby187/lib/ruby/
> gems/1.8/gems/rmagick-2.12.0-x86-mswin32/lib/RMagick.rb', and it's
> working!!!
>
> Question:
>
> why require 'RMagick' is not working, but require 'c:/ruby/ruby187/lib/
> ruby/gems/1.8/gems/rmagick-2.12.0-x86-mswin32/lib/RMagick.rb' is
> working????
>
> Thanks a lot!

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Alpha Blue wrote in post #1019380:
> I would decide what customizations you are willing to support or not
> support.

Life would be lovely if that were up to me. But the person with the
checkbook gets to make that decision. (Of course, I can charge more for
some customizations...)

> For the ones that you want to support, create a separate git
> and provide your customization gem/plugin there. In terms of skinning,
> this will be fairly easy. You could supply options for using different
> layout files which could include how the page displays, the CSS used,
> etc.

That's what I had in mind: swapping in different CSS files under git
control is straightforward. Swapping in different views isn't much
harder. Mercifully, the customer has not requested any 'tweaks' that
would require changes to the models or schema -- that could quickly
become a real PITA.

@Curtis Schofield: The customer is asking for more than just changes to
the CSS -- he wants different content and some additional views. And I
agree that this could become a nightmare -- I plan to maintain a bill of
materials, SKUs and ECOs for each variant of the app. That should help
some.

--
Posted via http://www.ruby-forum.com/.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

On Aug 31, 12:51 pm, Alexander Gitter <qwertz1...@googlemail.com>
wrote:

> I have a similar problem. Until now I used to assign a
> ActionDispatch::Http::UploadedFile to my parameter, which now doesn't
> work anymore in rails 3.1.
>
> Unfortunately I cannot use fixture_file_upload because it creates a
> Rack::Test::UploadedFile, which doesn't provide #tempfile:
>
> irb> params[:file].class
> => Rack::Test::UploadedFile
> irb> params[:file].tempfile
> NoMethodError: undefined method `tempfile' for #<Tempfile:0xb6591b70>
>

It doesn't have a tempfile method but it does actually wrap a Tempfile
and has a @tempfile instance variable. In the past I've reopened
Rack::Test::UploadedFile to add a tempfile method

Fred
> There already is a bug report about this problem with
> fixture_file_upload:https://github.com/rails/rails/issues/799

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails



On Wed, Aug 31, 2011 at 10:51 PM, 7stud -- <lists@ruby-forum.com> wrote:
Conrad Taylor wrote in post #1019393:
> On Wed, Aug 31, 2011 at 7:04 AM, Bruno Meira <goesmeira@gmail.com>
> wrote:
>
>>
> Bruno, I would recommend reading section 4.2 of the Rails routing guide:
>

I read that, and I don't see how applying a regex to the id will help.
How about adding :show to the :except clause and doing this:

match '/:id' => 'users/show'

having this line will match any controller's index action so i think that's not fine
unless you place this at the bottom of your routes file.
 
resources :users, :except=>[:destroy, :show]

in the Segments Constraints section of the rails guide, you'll see the first line of code.
following that code, you can use

match 'users/:id' => 'users#show', :constraints => { :id => /\d/ }, :via => :get

the via option is important so that it will only match get requests.

 
--
Posted via http://www.ruby-forum.com/.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.




--
-------------------------------------------------------------
visit my blog at http://jimlabs.heroku.com

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Conrad Taylor wrote in post #1019393:
> On Wed, Aug 31, 2011 at 7:04 AM, Bruno Meira <goesmeira@gmail.com>
> wrote:
>
>>
> Bruno, I would recommend reading section 4.2 of the Rails routing guide:
>

I read that, and I don't see how applying a regex to the id will help.
How about adding :show to the :except clause and doing this:

match '/:id' => 'users/show'
resources :users, :except=>[:destroy, :show]

--
Posted via http://www.ruby-forum.com/.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

On Wed, Aug 31, 2011 at 7:27 AM, Conrad Taylor <conradwt@gmail.com> wrote:

On Wed, Aug 31, 2011 at 7:04 AM, Bruno Meira <goesmeira@gmail.com> wrote:
I have the following problem:
- I have a controller called UsersController and I need to restrict
the show URL to use only numbers, How can I do that?
my routes.rb has this line:
resources :users, :except=>[:destroy]
How I add this constraint in this line?
I know that there is a command :constraints, but I dont know how to
use in resources ;/
Thanks :D


Bruno, I would recommend reading section 4.2 of the Rails routing guide:


 

Good luck,

-Conrad
 
--

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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.



--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Thanks very much. Good point, too.

Walter

On Aug 30, 2011, at 11:35 PM, Julian Leviston wrote:

> In my opinion, this API is borked. See my other message for usage
> but I reckon the :as should be replaced with :using or something else
>
> Blog: http://random8.zenunit.com/
> Twitter: http://twitter.com/random8r
> Learn: http://sensei.zenunit.com/
> New video up now at http://sensei.zenunit.com/
> real fastcgi rails deploy process! Check it out now!
>
>
> On 31/08/2011, at 1:16 PM, Walter Lee Davis <waltd@wdstudio.com>
> wrote:
>
>> I have Titles and People, and I want a single Image class that can
>> apply to either. I'm reading the Rails API on Polymorphic
>> Associations, and I'm getting confused by the example. Can anyone
>> explain how to do this:
>>
>> Title
>> has_many :images
>>
>> Person
>> has_many :images
>>
>> Image
>> belongs_to [either :image or :title]
>>
>> Thanks very much in advance,
>>
>> Walter
>>
>> --
>> 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@googlegroups.com
>> .
>> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com
>> .
>> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
>> .
>>
>
> --
> 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@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
> .
>

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails



On Wed, Aug 31, 2011 at 10:04 PM, Bruno Meira <goesmeira@gmail.com> wrote:
I have the following problem:
- I have a controller called UsersController and I need to restrict
the show URL to use only numbers, How can I do that?
my routes.rb has this line:
resources :users, :except=>[:destroy]
How I add this constraint in this line?
I know that there is a command :constraints, but I dont know how to
use in resources ;/

 
Thanks :D

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.




--
-------------------------------------------------------------
visit my blog at http://jimlabs.heroku.com

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

7stud -- wrote in post #1019391:
> How about:
>
> match '/:id' => 'users/show'
> resources :users, :except=>[:destroy]

Sorry, that doesn't meet your requirements because both '/1' and
'/show/1' will match.

--
Posted via http://www.ruby-forum.com/.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

On Wed, Aug 31, 2011 at 7:04 AM, Bruno Meira <goesmeira@gmail.com> wrote:

I have the following problem:
- I have a controller called UsersController and I need to restrict
the show URL to use only numbers, How can I do that?
my routes.rb has this line:
resources :users, :except=>[:destroy]
How I add this constraint in this line?
I know that there is a command :constraints, but I dont know how to
use in resources ;/
Thanks :D


Bruno, I would recommend reading section 4.2 of the Rails routing guide:


Good luck,

-Conrad
 
--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.


--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

How about:

match '/:id' => 'users/show'
resources :users, :except=>[:destroy]

--
Posted via http://www.ruby-forum.com/.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I have the following problem:
- I have a controller called UsersController and I need to restrict
the show URL to use only numbers, How can I do that?
my routes.rb has this line:
resources :users, :except=>[:destroy]
How I add this constraint in this line?
I know that there is a command :constraints, but I dont know how to
use in resources ;/
Thanks :D

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Supply the associations you have set in your model files and then supply
the query you are using or having trouble with.

--
Posted via http://www.ruby-forum.com/.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

How to get current binding in a partial (to use helpers and local
variables in erb script)?

When I invoke result whithout binding,

= ERB.new("script").result.html_safe

all work (without vars are needed), but when I write

= ERB.new("script").result(binding).html_safe

(in HAML HTML partial), THE PARTIAL'S REST OF OUTPUT IS CLEAR.

What is the problem?

--
Posted via http://www.ruby-forum.com/.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I would decide what customizations you are willing to support or not
support. For the ones that you want to support, create a separate git
and provide your customization gem/plugin there. In terms of skinning,
this will be fairly easy. You could supply options for using different
layout files which could include how the page displays, the CSS used,
etc.

--
Posted via http://www.ruby-forum.com/.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Thanks so far guys. Will try this. Currently I'm using a very raw
string concatenation which just appends the page - and the id.

> forum_topic_path(@topic.forum, @topic) + "?page=" + find_topic_page(@post) + "#post-" + @post.id
it is. So well, I'd be glad if I could replace it with the nice and
shiny version.. But how to append the # anchor thingy then, is there
some option for that?

Thanks, as said :)

On 31 Aug., 04:52, 7stud -- <li...@ruby-forum.com> wrote:
> Jim ruther Nill wrote in post #1019226:
>
> > On Tue, Aug 30, 2011 at 10:29 PM, 7stud -- <li...@ruby-forum.com> wrote:
>
> >> > Post model, controller, etc., and I want this controller to redirect
>
> > As 7stud pointed out, you might want to resort to using named_routes.
> > But I
> > think 7stud's syntax
> > is a bit wrong.
>
> Whoops.  You're right.
>
> --
> Posted viahttp://www.ruby-forum.com/.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

> fixture_file_upload should still work

Worked for me. Thanks.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Just an update...

I removed older versions of libxml2 and libxslt and reinstalled them
from the source and it appears to be working.

Thank you for all your help, again

--
Posted via http://www.ruby-forum.com/.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

require 'openid/store/filesystem'
require "openid/fetchers"

OpenID.fetcher.ca_file = "#{Rails.root}/certs/ca-bundle.crt"

provider :openid, OpenID::Store::Filesystem.new('./tmp'), :name =>
'google', :identifier => 'https://www.google.com/accounts/o8/id'

provider :facebook, 'yourinfo', 'yourinfo', {:client_options => {:ssl =>
{:verify => false}}}

provider :twitter, 'yourinfo', 'yourinfo'


This is my configuration for development...

You can create a certs folder in your rails root and put the
ca-bundle.crt file in there. You can find it here:

http://certifie.com/ca-bundle/ca-bundle.crt.txt

--
Posted via http://www.ruby-forum.com/.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Hello,
In the process of updating from 1.9.2-p180 to 1.9.2-p290 I found
that deserialising a serialised attribute as a Hash, which contains
other models, stopped working. If I reference the models which are
included in the hash prior to deseralising everything works fine.

Instantiating the model in p290 without referencing the models
raises:
ActiveRecord::SerializationTypeMismatch: combination was supposed to
be a Hash, but was a String

This is on Rails 3.0.10, the database field holding the attribute
is large enough to hold the serialised attribute. The models in the
hash are Price and a bunch of Shop models.
RVM is used to switch between p180 and p290. The gem versions are
identical (gemset was copied from p180 to p290).


class ListPrice < ActiveRecord::Base
## Referencing the models before deserialising the attribute makes
deserialising work in 1.9.2-p290, but is not needed in 1.9.2-p180
Price
Shop.all.each {|shop| shop}
serialize :combination, Hash

...
end


Any thoughts on what's happening here?

Cheers,
Dan

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

So essentially you're trying to do something like this?


  modelname.where(:name => "foo").union(modelname.where(:name => "bar"))

Since it's the same model, I don't think there's a reason to use a union in this case. Isn't this really just an OR operator?

  select * from modelname where name = "foo" or name = "bar"

Couldn't you just use the or operator like so?

  modelname.where("name = ? or name = ?", "foo", "bar").order("something")

Granted, your WHERE clause is probably more complex than that, but the principle should be the same.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/8LKcfxmrF3gJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I have:

Windows XP Professional SP3
Ruby 1.8.7
Rails 3.0.10
Bundler 1.0.15
ImageMagick 6.5.6 Q8
Rmagick 2.12.9

My gemfile:

gem 'rmagick-2.12.0-x86-mswin32', '2.12.0', :path => 'c:/sites/
uplodify/vendor'

My controller:

require 'RMagick'

Here I have installed my rmagick gem:

c:/ruby/ruby187/lib/ruby/gems/1.8/gems/rmagick-2.12.0-x86-mswin32/

But when I launch the controller, there is a message:

no such file to load -- RMagick

Then, I change require 'RMagick' to require 'c:/ruby/ruby187/lib/ruby/
gems/1.8/gems/rmagick-2.12.0-x86-mswin32/lib/RMagick.rb', and it's
working!!!

Question:

why require 'RMagick' is not working, but require 'c:/ruby/ruby187/lib/
ruby/gems/1.8/gems/rmagick-2.12.0-x86-mswin32/lib/RMagick.rb' is
working????

Thanks a lot!

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails



On Wed, Aug 31, 2011 at 5:53 PM, Pab <prabu.net88@gmail.com> wrote:
Hi,


     i got search which shows following error

      ActionView::Template::Error (undefined method `model_name' for
NilClass:Class):

i think this happens when @employee is nil. double check that @employee is not nil.
 
   1: <%= form_for(@employee) do |e| %>
   2: EMP ID<%= e.text_field :id %><br>
   3: <%= e.submit 'search', :controller => 'employees', :action =>
'search1' %>
   4: <% end %>
 in my search action i dint provide anything like
def search
end

if i use  <%= form_for(:employee) do |e| %>
it shows no error but the data is moving in to my "show" action

  could any one provide me a soultion ?

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.




--
-------------------------------------------------------------
visit my blog at http://jimlabs.heroku.com

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails



On Wed, Aug 31, 2011 at 6:24 PM, Leo M. <lists@ruby-forum.com> wrote:
But it doesn't work on my app.

I don't know why, I downloaded it and installed with bundle install, but
still when I add to a certain model the string :
acts_as_taggable

I systematically obtain an error, so I was trying to avoid this by
creating by myself the method.


there's actually 3 gems for tagging, you mentioned the first two and I said the other one.
I suggest you uninstall the gems you mentioned and use acts_as_taggable_on

If you have troubles making it work, post the errors and we'll see what we can do to help
debug.  Sometimes, it's nice to try to do some things manually but in this case, doing so
will just cost you time and effort.
 
--
Posted via http://www.ruby-forum.com/.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.




--
-------------------------------------------------------------
visit my blog at http://jimlabs.heroku.com

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.