[Rails] Any suggestions for promoting a new gem prototype for feedback?

2016-12-13 Thread Tim Edwards
I've just prototyped a new gem and looking for suggestion of how to let 
people know it exists so that I can get feedback. I've posted within Ruby 
on Rails on Ruby-Forum.com and am soliciting advice on the #ruby and 
#rubyonrails irc channels. Just wondering if there is more I can do, so any 
suggestions would be greatly appreciated.

Thanks,
Tim

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/f2d5ef6a-759d-46c1-9477-dac2d1b43925%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Create a ecommerce page with rails backend in 16 min

2015-11-13 Thread Tim
*Create a ecommerce page with rails backend in 16 min *

Tutorial Series

https://www.youtube.com/watch?v=2-GgdayPLro

Thanks !

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/28149878-dec5-43b8-8dd0-f906a432fce0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] UiReady Tutorial Series Released & Get Shit Done Rails Version now Open Source

2015-11-09 Thread Tim


Hi Everyone, i have been learning rails for a while, one thing alway 
challenge me when developing rails is frontend development and integration. 
I really want to find a way to keep pushing programmer happiness on using 
rails. So i have spent almost one year to building ui resource marketplace 
platform which highly focusing on rails framework. By partner with other 
theme authors, right now we created two rails ui kit templates which called 
“Get Shit Done Pro” and “Get Shit Done”. Pro is the paid version and 
without Pro is the free version

Tutorial Series
https://www.youtube.com/watch?v=2-GgdayPLro

Get Shit Done Pro
https://uiready.io/items/get-shit-done-pro-rails-version

Get Shit Done
https://uiready.io/items/get-shit-done-rails-version

I would really appreciate for any feedbacks and suggestions. So that we can 
make this gem better.

For Moderators, if this post is not suitable in here. Please remove it and 
sorry for any disturbance caused.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/461fd73b-4702-4db6-aaf8-ab691a59f087%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Sprockets Rails -- asset host with prefix question

2015-09-10 Thread Tim L
Hey there,

I wanted to set the asset host in my Rails project to point to my CDN. The 
CDN is pointing directly to the assets directory so that I didn't have to 
deal with duplicative content being found via crawlers if they crawl my 
CDN's domain and I had pointed it to the root of my site. The problem is if 
I set my asset_prefix to '' it'll cause the files to be stored via 
sprockets so they are referenced without the assets directory but I wanted 
to have them still in the assets directory so the origin can reference that.

I was able to get things working by hacking in a change to sprocket-rails 
asset helper to not use the asset prefix but it's still there for the 
purposes of pre compilation so the assets folder can be pointed to by my 
CDN.

Is there some other way to go about accomplishing this without needing to 
hack the asset helper logic? Wondering how others have dealt with this 
issue themselves. Alternatively I guess I could have uploaded my assets to 
s3 and use my CDN pointing to that and then I wouldn't need to worry about 
the root of my site being accessible it was just easier to avoid s3 
completely by forcing sprocket-rails to just not append that prefix when 
generating the asset paths.

Thanks,

Tim

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/ddc9ba28-2349-4dff-a0d7-4dc4e8a34b9b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Moving from Engineyard to Amazon's OpsWorks

2014-02-04 Thread Tim Swetonic
Hello all,

We're considering moving our Rails app from Engineyard to Amazon's 
OpsWorks. We should have a considerable savings doing this. 

Has anyone out there done this? Just wondering what horror stories (or good 
stories) there are in doing this.

Thanks

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/0c8ae66f-2342-4569-8173-6b4b944bca12%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: having isues with creating a ajax call in my simple rails application ,

2013-06-27 Thread Tim Millwood
What's the issue?

On Wednesday, 26 June 2013 10:30:43 UTC+1, hussainakhtar wahid wrote:
>
> hi all ,
>
> having isues with creating a ajax call in my simple rails application , 
>
> can any body be available for some time to help on mail or chat ??
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/3b4eaba8-3c0a-48bc-bcfb-d7c20b61b882%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Rails 4 install

2013-06-27 Thread Tim Millwood
It doesn't look like rails is installed.

No idea how to do it on Windows but on Linux or Mac I would suggest 
running, gem install rails

On Thursday, 27 June 2013 03:18:48 UTC+1, Oliver David wrote:
>
> I'm newbie and installed Rails last week.  When I did rails -v in cmd 
> prompt, I got this:
>
> C:\Users\oliver\lesson3>ruby -v
> ruby 2.0.0p0 (2013-02-24) [i386-mingw32]
>
> C:\Users\oliver\lesson3>rails -v
> 'rails' is not recognized as an internal or external command,
> operable program or batch file.
>
>
> I want to upgrade or install Rails 4.  Does this mean I don't have Rails 
> installed?  I used RailInstaller 3.0 last week to install Ruby on Rails.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/04482cee-9b7f-468f-89fa-1887953b132a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] Re: Complex abilities and scoping of records

2013-02-21 Thread Tim Uckun
On Fri, Feb 22, 2013 at 3:51 AM, javinto  wrote:
> Have you been looking at CanCan?
>
> I've implemented a similar situation with CanCan. It will not cover your
> needs for 100% but it will do a lot.
>

Yes I have been looking at cancan. I have also been looking at Consul.
 Of the two Consul seems to have a little more power and is scope
based so it's probably worth giving a shot but it looks like cancan
has won the popularity war anyway.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Complex abilities and scoping of records

2013-02-20 Thread Tim Uckun
I have the following scenario.

Users have various levels of ability.  They can only view and edit
their own records (their profile).  Their managers can only view and
edit their employees records. The regional managers can view and edit
only the people in their regions and the corporate headquarters can
view and edit all records.  There are multiple regions  so somebody
can be the manager of the north region and somebody is the manager of
the south region. They both have the role of "regional manager".

Of course this also applies to any of the child relations as well
(addresses, phone numbers etc).

I am struggling with a clean way to write a controller which would
only show the records they have the right to on the index method. I
want to avoid silly and complex case statements  and I also want avoid
roles like "regional manager north".

I figure somebody here has run into this problem.  What is the most
elegant way to solve this problem.

Cheers.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Disable back button of browser

2012-12-21 Thread Tim Slattery
Rafi A  wrote:

>Ashok,
>
>You can disable the browser back button with the help
>of JavaScript snippets:

I don't think so. This is in the FAQ in comp.lang.javascript, and the
answer is that it can't be done.

-- 
Tim Slattery
slatter...@bls.gov

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Version issue with First App in Hartl Tutorial

2012-10-13 Thread Tim Escher
Stepping through the Hartl Rails 3 Tutorial from the 2nd edition book hot 
off the presses. Modified the Gemfile *exactly* as specified in the book, 
immediately got version issues:

Could not find gem 'jquery-rails (= 2.0.0) x86-mingw32', etc., etc.

Tried removing the version spec from various gems, but it was like peeling 
an onion - other stuff would start failing.

Running Win 7 for Rails.

Any help appreciated. 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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/tSljVIet4N0J.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Email with out SMTP Settings is it possible

2012-09-24 Thread Tim Slattery
KUL KING  wrote:

>So I was right that we have to use SMTP to send email. Whether it is from
>localhost or gmail. Am I right?

SMTP = Simple Mail Transfer Protocol. That's the language you use to
talk to another computer to send mail. Usually, you talk to a server
whose job is to take mail from you and send it on to its destination.
If it can't contact the destination machine the first time it tries,
it will wait a while and try again. It won't give up until a few
iterations of this.

You can bypass that and have your program directly contact the
destination machine. In that case, you have to parse the address to
get the domain name, look up the MX record in the DNS for that domain
(not the normal A record), then establish contact with the remote
machine, etc. Using an SMTP relay server is much simpler.

-- 
Tim Slattery
slatter...@bls.gov

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: rails s

2012-08-24 Thread Tim Slattery
Nailson Martins 
wrote:

>Probably you are running the command in the wrong location, to do any 
>command, you must do at the location of your Rails app.

And when you do, only a few lines appear on the screen. You then aim
your browser at http://localhost:3000, and your app should appear.

-- 
Tim Slattery
slatter...@bls.gov

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: "Undefined method"

2012-08-23 Thread Tim Slattery
Colin Law  wrote:


>It was not that in the first place, according to your post it was
><%= form_for @jolts_registry do |f| %>

ah..Right. I tried a good many things, kept getting the exact same
error until putting the "action" phrase in. yes I looked at the
routing doc. Didn't see anything to help. Still don't get it.

-- 
Tim Slattery
slatter...@bls.gov

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: "Undefined method"

2012-08-22 Thread Tim Slattery
Tim Slattery  wrote:

>Colin Law  wrote:
>
>
>>> Don't understand, which route?
>>
>>You are trying to create a form for a JoltRegistry, that expects to
>>submit to a jolts_registries_path (as in the error message).  The
>>normal way to generate the route would be to use
>>resources :jolts_registries
>
>I've done that. Same message. I've tried several different
>permutations of methods, etc. Always the exact same message. I have no
>clue in the world what in the hell it wants me to do. I have no clue
>where it gets "jolts_registries" from in the first place.

Changing the form tag from 

<%= form_for @registry do |f| %>

to 

<%= form_for @registry, :url => { :action => "create" } do |f| %>

fixed it.

-- 
Tim Slattery
slatter...@bls.gov

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: "Undefined method"

2012-08-22 Thread Tim Slattery
Colin Law  wrote:


>> Don't understand, which route?
>
>You are trying to create a form for a JoltRegistry, that expects to
>submit to a jolts_registries_path (as in the error message).  The
>normal way to generate the route would be to use
>resources :jolts_registries

I've done that. Same message. I've tried several different
permutations of methods, etc. Always the exact same message. I have no
clue in the world what in the hell it wants me to do. I have no clue
where it gets "jolts_registries" from in the first place.

-- 
Tim Slattery
slatter...@bls.gov

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: "Undefined method"

2012-08-22 Thread Tim Slattery
Colin Law  wrote:

>On 21 August 2012 21:12, Tim Slattery  wrote:
>> I have a controller named RegistriesController. It contains a single
>> method:
>>
>> def edit
>>@jolts_registry = JoltsRegistry.new
>> end
>>
>> This runs, and the associated view is invoked. That stops on line 9:
>>
>> <%= form_for @jolts_registry do |f| %>
>>
>> The message is:
>>
>> undefined method `jolts_registries_path' for
>> #<#:0x1cf7aa0>
>>
>> What does that mean?
>
>Have you put an entry for jolts_registries in routes.rb?  Probably
>something like
>resources :jolts_registries

I have 

match '/registries' => 'registries#edit;

It clearly finds the route, otherwise it wouldn't run the edit method
in registries_controller.

>form_for needs the route to generate the form tag.

Don't understand, which route?

-- 
Tim Slattery
slatter...@bls.gov

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] "Undefined method"

2012-08-21 Thread Tim Slattery
I have a controller named RegistriesController. It contains a single
method:

def edit
   @jolts_registry = JoltsRegistry.new
end

This runs, and the associated view is invoked. That stops on line 9:

<%= form_for @jolts_registry do |f| %>

The message is:

undefined method `jolts_registries_path' for
#<#:0x1cf7aa0>

What does that mean?

-- 
Tim Slattery
slatter...@bls.gov

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Rails session ID

2012-08-16 Thread Tim Slattery
tomkins  wrote:

>Try request.session_options[:id]

Thanks to all who replied. The code above worked. No doubt some of the
other suggestions would have also.

Many thanks from someone trying to figure out Ruby and Rails at the
same time!

-- 
Tim Slattery
slatter...@bls.gov

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Rails session ID

2012-08-14 Thread Tim Slattery
I'm trying to retrieve the session ID in rails. I found a web page
that said to use

session.session_id

But when I do that, I get:

undefined method `session_id' for
#

What do I need to do?

-- 
Tim Slattery
slatter...@bls.gov

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: how to do form parameter naming from the form tag?

2012-08-13 Thread Tim Shaffer
Sorry, should have been  "something[person][name]" instead of  
 "something[session][email]"

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/9CdjxUpV5OsJ.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: how to do form parameter naming from the form tag?

2012-08-13 Thread Tim Shaffer
You can use the "as" option on your form_for tag:

form_for(@person) will generate inputs like "person[name]"

form_for(@person, :as => "something[person]") will generate an input like 
"something[session][email]"

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/sjyTBLr04kUJ.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: button_to with image

2012-08-10 Thread Tim Shaffer
If the button is to submit a form, you can use image_tag_submit

http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#method-i-image_submit_tag
 

Otherwise, you can just use link_to(image_tag(...))

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/jFqmhq7yvZAJ.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] button_to with image

2012-08-10 Thread Tim Slattery
I'm calling button_to in my page, and it renders a form with a submit
button just fine. But what I'd really like is 



instead of

https://groups.google.com/groups/opt_out.




[Rails] Re: Associations join

2012-06-19 Thread Tim Shaffer
Check out the guide to associations. It should have more information than 
you need...

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

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



[Rails] Re: Server is not starting

2012-06-19 Thread Tim Shaffer
Check what the error message is telling you. You need to install a 
JavaScript runtime.

Could not find a JavaScript runtime. See 
https://github.com/sstephenson/execjs for a list of available runtimes 

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



[Rails] Re: issues with text_field in rails

2012-05-08 Thread Tim Shaffer
It's case sensitive. Are you sure you don't mean "name" instead of "Name"?

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



[Rails] Re: SQLite3 to Postgre Problem

2012-05-01 Thread Tim Shaffer
The error message is telling you the problem:

relation "appointments" does not exist 

Can you post the contents of your CreateAppointments migration file? I'm 
assuming this is where the appointments table should be created.

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



[Rails] Re: undef keyword with symbol

2012-04-30 Thread Tim Shaffer
id and class are built-in ruby methods that are present on all object 
instances.

Rails uses them in a different manner than the default Ruby implementation.

They are undefined so that they can be picked up by the method_missingmethod.

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



[Rails] Re: What naming conventions do you use when writing i18n yaml files?

2012-04-27 Thread Tim Shaffer
For your first example, Rails already has built-in keys for submit buttons 
that you can change globally:

en:
  helpers:
submit:
  create: "Create %{model}"
  update: "Update %{model}"

Or only for a specific model:

en:
  helpers:
submit:
  post: 
create: "Create the new post"
update: "Update existing post"

Those are used automatically when you use <%= f.submit %>

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



[Rails] Re: How to implement File Uploading

2012-04-20 Thread Tim Shaffer
Just curious why you want to do this without using any database or models 
or gems?

At any rate, check out this tutorial below. It uses a model, but you can 
copy the code from the DataFile class to accomplish what you are trying to 
do.

http://www.tutorialspoint.com/ruby-on-rails/rails-file-uploading.htm 

By the way, that tutorial is the first result in Google when you search for 
"file upload rails" Google is usually a good place to start for questions 
like this.

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



[Rails] Re: value pass from controller to view

2012-04-17 Thread Tim Shaffer
Your folder structure does not seem right. You should not have a "home" 
folder. You should have a "users" folder with a "home.html.erb"

On Tuesday, April 17, 2012 10:06:30 AM UTC-4, amvis wrote:
>
> i have one controller
> *class UsersController < ApplicationController*
> *  *
> *  def home*
> *   @business_name = return_value["business"]*
> *   puts "business_name.#{@business_name}" *
> *  end*
> *end*
> *
> *
> and in *home* folder i have one view branch.html.erb.My problem is, 
> when i display this <%=*@business_name %>* in branch.html.erb, i didn't 
> get anything...
> What is the issue in this view?
>
>
> Thank you
> vishnu
>

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



[Rails] Re: Rails 3.2 with many stylesheet assets in dev mode => error with IE HTC-behaviours

2012-04-13 Thread Tim Shaffer
Set config.assets.debug = false in config/development.rb

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



[Rails] Re: one master table to hold symbols: good or bad idea?

2012-04-03 Thread Tim Shaffer
What problem are you trying to solve by doing this?

Just seems like it would make your code more complicated with no real 
benefit.

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



[Rails] I18n.t('countries.NO') broken?

2012-04-01 Thread Tim Shaffer
"no" is a reserved word. You will need to enclose it in quotes.

"NO": Nope

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



[Rails] Re: Help Converting from SQL to Rails syntax

2012-03-30 Thread Tim Shaffer
I am a little confused here. If ModelB belongs to ModelA, I think your 
foreign key relationship is backwards. The model_b_table should have a 
foreign key to model_a_id, not the other way around.

Regardless, though, you can pass conditions to delete_all which should help 
you accomplish what you want.

ModelA.delete_all("model_b_id is null")

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



[Rails] Re: controller missing - locale

2012-03-30 Thread Tim Shaffer
Can you paste the exact error that you are getting?

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



[Rails] Re: why doesn't .where() honor polymorphism?

2012-03-28 Thread Tim Shaffer
When you write "belongs_to :parent" Rails expects there to be a class 
called Parent.

If you want this to be related to the MyModel class, you'll need to 
explicitly state that:

 belongs_to :parent, :class_name => 'MyModel'

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



Re: [Rails] Postgres COPY from STDIN

2012-03-21 Thread Tim Uckun
> conn = ActiveRecord::Base.connection_pool.checkout
> raw  = conn.raw_connection
> raw.exec("COPY tablename (col1, col2, col3) FROM STDIN")
> # open up your CSV file looping through line by line and getting the line 
> into a format suitable for pg's COPY...
> rc.put_copy_data line
> # once all done...
> rc.put_copy_end
> while res = rc.get_result do; end # very important to do this after a copy
> ActiveRecord::Base.connection_pool.checkin(conn)
>

I did try that and it doesn't work.  Not only doesn't it work but it
fails silently. I wrote a more elaborate routine which I can get to
run without errors but it still doesn't add the records in the table.

 conn.transaction do
rc = conn.raw_connection
rc.exec "TRUNCATE TABLE #{table_name};" if options[:truncate]
sql = "COPY #{table_name} (#{field_list.join(',')}) FROM STDIN
#{sql_parameters} "
p sql
rc.exec(sql)
begin

  if method == 1
rc.put_copy_data text + "\\.\n"
  else
text.each_line { |line| rc.put_copy_data(line) }
  end
rescue Errno => err
  errmsg = "%s while reading copy data: %s" % [err.class.name,
err.message]
  puts "an error occured"
end
if errmsg
  rc.put_copy_end(errmsg)
  puts "ERROR #{errmsg}"
else
  rc.put_copy_end
end
while res = rc.get_result
  puts "Result of COPY is: %s" % [res.res_status(res.result_status)]
end
puts "end"
  end #transaction

Maybe it's a bug in the PG gem?

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



[Rails] Postgres COPY from STDIN

2012-03-20 Thread Tim Uckun
I have done some googling to try and figure out how I can use COPY
FROM STDIN with rails and have ran into some posts on stackoverflow or
the mailing list but none of them seem to be working with rails 3.2
Does anybody have a working example of using COPY FROM STDIN?

Some things I have tried

https://bitbucket.org/ged/ruby-pg/src/tip/sample/copyfrom.rb
http://blog.edseek.com/archives/2009/04/26/putline-undefined-for-pgconn/

and similar variations. Nothing seems to be working though.

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



[Rails] help with DL and user32.dll

2012-03-18 Thread Tim K
Very intermediate into programming and never done anything with visual
basic, although if anyone could help me better understand the
following I would be very greatful!

In my ruby script I have

require "dl"
user32 = DL.dlopen('user32')

actWindow = DL::CFunc.new(user32['GetActiveWindow'],DL::TYPE_VOID,
'GetActiveWindow')
actWindow.call()

which has wrong number of arguments, needs an array passed into it.

actWindow.call([]) returns type nil

I'm not sure what I should be passing into call method as the function
is of DL::TYPE_VOID?

GetActiveWindow - 
http://msdn.microsoft.com/en-us/library/windows/desktop/ms646292%28v=vs.85%29.aspx


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



[Rails] Re: Sharing session variables across Controllers?

2012-03-08 Thread Tim Shaffer
Session variables should be shared, unless I'm not understanding the 
question.

You can set a session variable in one controller like so:

session[:my_key] = 'my value'

Then access it in another controller by simply calling session[:my_key]

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



[Rails] Re: redirect_to flash

2012-03-07 Thread Tim Shaffer
I believe those two are just the most common.

Look at the rest of the code, though. It looks like you can specify other 
flash values like so:

redirect_to suppliers_path, :flash => { :success => 'Supplier was 
successfully created.' }

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



[Rails] Re: account controller, can I use 2 layouts within the same controller?

2012-03-07 Thread Tim Shaffer
You can specify a layout that applies only to specific actions in a 
controller:

layout "whatever", :only => [ :some_action ]

Check out the guide on layouts for more options: 
http://guides.rubyonrails.org/layouts_and_rendering.html
>
>

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



Re: [Rails] string differences between ruby 1.8 & 1.9.3

2012-03-06 Thread Tim Shaffer
For the simple reason that single quotes in Ruby do not allow for string 
interpolation (such as \r and \n), while double quotes do.

On Tuesday, March 6, 2012 2:33:23 PM UTC-5, Craig White wrote:
>
>
> .join("\r\n") did the trick. Needed to use double quotes and not single 
> quotes (don't understand why).
>

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



[Rails] Re: Twitter like route

2012-03-06 Thread Tim Shaffer
Your constraint is slightly wrong.

Unless you are settings "request.session[:token]" somewhere else in your 
code, chances are it's going to be nil. What you most likely want to check 
for is "request.params[:token]" which will match the token in the URL.

You also have it backwards. The constraint would currently only ALLOW 
assets and admin. You need to negate that statement.

Fix those 2 issues and you should be in business.

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



[Rails] Re: how to use link_to with :remote=>true in rails 3.2.1

2012-02-29 Thread Tim Shaffer
You probably want to use $("#allclick").update instead of 
$("allclick").update

Note the # that indicates you are selecting an element by the ID.

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



[Rails] Re: Collect users who posted items with ActsasTaggable on Tag in rails 3

2012-02-22 Thread Tim Shaffer
How do your Article and Blog models relate to the User model?

Assuming User has many Articles and Blogs you can simply do this:

user = User.find_by_whatever("something")
user.articles.tagged_with("tagname")
user.blogs.tagged_with("tagname") 

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



[Rails] Re: Conditional Logic on link_to with a block.

2012-02-21 Thread Tim Shaffer
Maybe just put the logic in the controller?

if @brand.nil?
  if @store.nil?
@brand_link_path = from_catalog_path(params[:id].blank? ? 
Category.root.id : params[:id], product.id, product.name_url)
  else
@brand_link_path = from_store_path(@store.id, product.id)
  end
else
  @brand_link_path = from_brand_path(@brand.id, product.id)
end

Then it simplifies your view:

<%= link_to(@brand_linnk_path) do -%> HTML HERE <% end %>

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



[Rails] Re: link_to param body

2012-02-21 Thread Tim Shaffer
Well you have at least two options to "hide" the parameters:

You could change your link_to call and include :method=>:post so it does 
actually send a post request. This doesn't really hide the parameters since 
the user can still view the source of the page and look at them.

You could send them as an encrypted parameter in the URL, then decrypt them 
on the receiving page. This actually obfuscates the parameter so the user 
can't see the actual parameters.


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



[Rails] Re: Polymorphic associations with ownership

2012-02-03 Thread Tim Shaffer
Sounds like you could just add a "belongs_to :user" to the Comment class.

But since you already have "comments" on the user, you'll need to give the 
reverse association another name. Perhaps "comments_owned"

So add "has_many :comments_owned, :class_name => Comment" to User.

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



[Rails] Re: Interesting strangeness with I18n.t

2012-01-30 Thread Tim Shaffer
Pretty sure that YES and NO are reserved words.

Try putting the definition in quotes:

"NO": Norway

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



[Rails] Re: Using search_field as select

2012-01-30 Thread Tim Shaffer
What exactly are you trying to do? All that search_field does is create a 
HTML input with type="search"

If you want a dropdown you should use collection_select or something similar

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



[Rails] Re: after_save in plugin

2012-01-30 Thread Tim Shaffer
I think your issue may be a mixup with class instance and instance 
variables.

However, what's the issue you are having with all this? Are you getting any 
error messages? 


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



[Rails] Re: Skipping the First Line when reading in a text file

2012-01-26 Thread Tim Shaffer
This is by no means a RoR question. But the solution is pretty simple, so 
I'll give in.

One way to do it would be to just put "next if line.lineno == 1" at the 
beginning of the loop.

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



[Rails] Re: redirect_to :back - Any way to go back two pages?

2012-01-25 Thread Tim Shaffer
If you can do it in JavaScript, you can always just do window.history.go(-2)

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



[Rails] Re: Rails 3 routes.

2012-01-20 Thread Tim Shaffer
It depends how you generate the controller. If you use a command like this:

rails g controller posts index show edit new update create destroy

It will indeed create a GET route for each action. Kind of annoying.

You can generate the restful controller and route declaration by using the 
following:

rails g resource post

But of course this will also attempt to create the migration and model 
files, which may not be desired. You can add the -s option to skip files 
that already exist.

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



[Rails] Re: How to encode (.) Dot in url Rails

2012-01-20 Thread Tim Shaffer
You have the  developer/:user_name/delete route set to use "delete" as the 
method, rather than "get"

Since browsers usually don't support sending requests other than post or 
get, you'll need to pass a "_method=delete" parameter to that route

Check out the rails guide on routing for more information:
http://guides.rubyonrails.org/routing.html#resources-on-the-web 

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



Re: [Rails] update data to database

2012-01-17 Thread Tim Shaffer
Just a note that you should be careful using this method to increment a 
value. It can cause a race condition.

A safer method is to use increment_counter since it updates the value 
directly in the database, not using the current attribute value on the 
instance

CurrentUser.increment_counter(:points_accumulated, params[:id])

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



[Rails] Re: Correct syntax for prompt for select_tag

2012-01-16 Thread Tim Shaffer
The :prompt option was not added until rails 3.1.0

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



[Rails] Re: Named Scope bug?

2012-01-16 Thread Tim Shaffer
This is not really a bug, but more due to the way Ruby evaluates when 
things are executed.

scope :current, where("start <= ? AND expiration > ?", DateTime.now, 
DateTime.now)

The code does use the current date/time, but the catch is that it doesn't 
use the current date/time when the scope is called, but when the model is 
loaded. Meaning, when the console is loaded or the app is started. It never 
updates the date/time used for the scope once it's loaded.

You'll want to use a Proc or lambda in this scenario, so the scope always 
uses the current date/time when the scope is called.

scope :current, Proc.new { where("start <= ? AND expiration > ?", 
DateTime.now, DateTime.now) }

That way, DateTime.now is only evaluated when the scope is called.

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



[Rails] Re: Correct syntax for prompt for select_tag

2012-01-16 Thread Tim Shaffer
Try this. You can pass a string to include_blank

:include_blank => "Please select" 

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



[Rails] Re: Correct syntax for prompt for select_tag

2012-01-16 Thread Tim Shaffer
Try this:

:include_blank => "Please select 

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



Re: [Rails] html inside of erb

2012-01-16 Thread Tim Shaffer
The problem is that the "inner" string is not marked as html_safe. In your 
link_to tag, this string is not considered html_safe:

link_to(*rights.controller + " » " + rights.action*, :controller 
=> "rights", :action => "edit", :id => rights.id)

Colin's suggestion, which is the solution, is to mark the inner string as 
html_safe. The easiest way to do this is to use the #{} notation instead of 
string concatenation:

link_to(*"#{rights.controller} » #{rights.action}".html_safe*, 
:controller => "rights", :action => "edit", :id => rights.id)

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



[Rails] Re: displaying rails form validation errors inline

2012-01-11 Thread Tim Shaffer
What does your view look like? Do you have any error message related code 
in there?

What does the output HTML look like? Is the error message repeated in the 
HTML?

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



[Rails] Re: how to make normal user as admin

2012-01-10 Thread Tim Shaffer
The easiest way is probably to just have a boolean "is_admin" field on the 
user model.

Really depends on your other requirements though.

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



[Rails] Re: Rails 3.1 assets pipeline issue in production

2012-01-04 Thread Tim Shaffer
If you don't want them to be compiled, you can just put them directly in 
the public/assets folder instead of in app/assets

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



[Rails] Re: How to set different id in nested form attributes

2012-01-04 Thread Tim Shaffer
How did all the children end up with the same ID?

Posting some of your problematic code can help us help you.

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



[Rails] Re: Am I having an asset problem?

2011-12-29 Thread Tim Shaffer
They are not compressed because you have "config.assets.debug = true"

Kind of strange though that they are in the wrong order. What does your 
javascript_include_tag look like, and what do the files it's calling look 
like? 

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



[Rails] Re: ApplicationController needs a #delete method

2011-12-29 Thread Tim Shaffer
I apologize... I guess I wasn't sure what you were asking.

ActionController::Base doesn't have *any* methods included. Not even the 
index, new, edit, etc. The only methods available are the ones you add in 
your application. So adding delete method to ActionController doesn't 
really make sense.

The delete method could be added to the default set of resourceful routes 
so you wouldn't need to add it to your routes manually, which is what I 
think you were referring to? I can definitely see your case for wanting to 
do this.

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



[Rails] Re: ApplicationController needs a #delete method

2011-12-28 Thread Tim Shaffer
You can easily add a delete method to your controller:

def delete
  @post = Post.find(params[:id])
end

Then add it to your routes as well:

resources :posts do
  get 'delete', :on => :member
end

And you're done

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



[Rails] Re: how to change Root_path after user sign in ?

2011-12-22 Thread Tim Shaffer
You could just have your welcome#index action redirect to another 
controller/action if the user is signed in.

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



[Rails] Re: Set Ruby Version in Rails Application

2011-12-12 Thread Tim
Sorry, I didn't mean to ask the same question again...when I clicked
the link in my email it said it was gone and I couldn't find it.
Sorry!  And thanks for your answer!  You are the best!

On Dec 11, 2:56 am, Colin Law  wrote:
> On 10 December 2011 23:43, Peter Vandenabeele  wrote:
>
> > On Sun, Dec 11, 2011 at 12:30 AM, Tim  wrote:
>
> >> Does anyone know if it is possible to set the ruby version (and thus
> >> the rails version) within a rails app?  Say I have 2 versions of ruby
> >> installed on my machine and version 1 is set in the path, but I want
> >> to use version 2 for this particular app.  Can I set that in the path
> >> or does that have to be set for the whole system?
>
> > With rvm this becomes trivially simple 
>
> Coincidentally that is the same answer I gave when you asked the same
> question a couple of days ago.  Rather than asking the question again
> (presumably in the hope of other options) you would have been better
> to continue the same thread and ask for further options if rvm does
> not do what you want.
>
> Colin

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



[Rails] Set Ruby Version in Rails Application

2011-12-10 Thread Tim
Does anyone know if it is possible to set the ruby version (and thus
the rails version) within a rails app?  Say I have 2 versions of ruby
installed on my machine and version 1 is set in the path, but I want
to use version 2 for this particular app.  Can I set that in the path
or does that have to be set for the whole system?

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



[Rails] Choose Ruby Version on Startup

2011-12-09 Thread Tim
Hi,

I am wondering if it is possible to change the ruby version that rails
is using on startup and not use the version that is set in the PATH of
the application. For example say the server has the path set to "/
ruby1" and I want to use "/ruby2" can I set that in the rails
application itself instead of in using only what the path is set to?

Thanks in advance for any help!

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



Re: [Rails] doubts with link_to function

2011-12-09 Thread Tim Shaffer
"report_listing_path will return the path to whatever route you have 
defined as "report_listing"

You can run "rake routes" from the command line to see which routes you 
have configured in your application.

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



[Rails] Re: what do you think it's better for pagination?

2011-12-09 Thread Tim Shaffer
I've used both, but prefer kaminari.

I like kaminari's concept of scopes and using views rather than the method 
will_paginate uses.

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



Re: [Rails] Rails 3.1 and minitest

2011-11-17 Thread Tim Uckun
I'll bump this. I too am interested in getting minitest working
especially with autotest.

I kind of got something going but it's ugly and doesn't work with autotest.


On Thu, Oct 20, 2011 at 12:37 PM, djangst  wrote:
> I'm looking for a simple way to integrate minitest/spec with Rails
> 3.1. Anybody have it working?
>
> There's an older article on MetaSkills about this but it adds stuff I
> don't want.
>
> --
> 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+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Ubuntu: Best IDE

2011-11-17 Thread Tim Uckun
Rubymine.

Has full support for git (and everything else you can think of)


On Fri, Nov 18, 2011 at 3:17 PM, Mathew S.  wrote:
> Anything but Aptana Studio
>
>
>
>
> I have not had good luck with Aptana... So Please give me a list of your
> favs.
>
>
> And how you would open up the files with git onto the program :) <3
>
> --
> 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+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Problem updating helper

2011-11-01 Thread Tim Shaffer
Did you restart rails on the production server after you updated the file? 
The old version is probably being cached.

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



[Rails] Re: Dynamical refresh div with in rails

2011-11-01 Thread Tim Shaffer
No rails necessary.

Check out the timeago jQuery plugin.

http://timeago.yarp.com/

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



[Rails] Re: nested routes not rendering properly in link helper

2011-10-31 Thread Tim Shaffer
On Sunday, October 30, 2011 9:31:50 PM UTC-4, John Merlino wrote:
>
>
>get "send_activation_notification" 
> => :send_activation_notification, :as => "send_activation" do 
>resources :users do 
>resources :accounts 
>  end 
>  end 
>
> But it doesn't work for me. Note that send_activation_notification is 
> not a restful route, so I couldnt model my code exactly as shown in 
> the rails book. 


That's not a valid route at all. I think you might have it backwards. Check 
out the results of "rake routes" if you need to see what all your routes 
look like.

Instead of this:

get "send_activation_notification" => :send_activation_notification, :as => 
"send_activation" do 
  resources :users do 
resources :accounts 
   end 
 end 

You might want to do something like this:

resources :users do
  get 'send_activation_notification', :on => :member
  resources :accounts
end

Then you will have a send_activation_notification_user route that you can 
use.
 

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



[Rails] Re: Migration reports success but did not do anything

2011-10-31 Thread Tim Shaffer
So whenever you migrate down and back up it works? Sounds like the 
migration is working properly then.

Under what circumstances does it not work?

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



[Rails] Re: How to make comment with jquery

2011-10-28 Thread Tim Shaffer
What do you mean by comment? Commenting your code? In that case you can 
just use a JavaScript comment:

// this is a comment

/*
this is also a comment
*/

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



[Rails] Re: Quick and Dirty SSL for a Rails app

2011-10-28 Thread Tim Shaffer
Well provided you don't have any code in your application that won't work 
with https, you should be good to go.

Just make sure the domain you are using to access your Rails application is 
SSL protected (via Apache, load balancer, or other means) and then simply 
access it using https.

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



[Rails] Re: Customizing errors

2011-10-25 Thread Tim Shaffer
error.full_messages does indeed call human_attribute_name.

Did you check the source for that method in the link you posted?

http://ar.rubyonrails.org/classes/ActiveRecord/Errors.html#M000311

full_messages << @base.class.human_attribute_name(attr) + " " + msg

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



[Rails] Re: additional model attributes

2011-10-25 Thread Tim Shaffer
I think for Rails to recognize that the attribute should be included, you 
need to use attr_accessible rather than the Ruby method attr_accessor.

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



[Rails] Re: Active record, postgresql sequences and primary keys

2011-10-21 Thread Tim Shaffer
On Friday, October 21, 2011 2:57:56 PM UTC-4, Ruby-Forum.com User wrote:
>
>
> Task: I want  use postgresql sequence for generation of  primary  key.
>   I use 'set_sequence_name', but  this don't work.
>

What part of it does not work? Are you getting any error messages? 

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



[Rails] Re: How to transform my html form into a rails 3 form

2011-10-21 Thread Tim Shaffer
Have a look at the documentation for check_box_tag

http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#method-i-check_box_tag

It specifies that any other keys passed to options will be used as HTML 
attributes. So you can pass your onclick attribute to check_box_tag in the 
options hash.

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



[Rails] Re: add an array to params

2011-10-21 Thread Tim Shaffer
On Friday, October 21, 2011 3:53:33 AM UTC-4, Ruby-Forum.com User wrote:
>
> But there is something wrong.
> Does someone can help me?
>
Probably. What is wrong? Are you getting any error messages? Have you 
checked out what params looks like in your controller (puts params.inspect)?

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



[Rails] Re: Access other model attributes directly with has_one, belongs_to ?

2011-10-20 Thread Tim Shaffer
I think what you're looking for is "delegate" which is a rails extension to 
Module:

http://api.rubyonrails.org/classes/Module.html#method-i-delegate

class ModelC < ActiveRecord::Base
  has_many :model_a
end

class ModelA < ActiveRecord::Base
  belongs_to :model_c
  delegate :version, :to => :model_c
end

Then you can call version on a ModelA instance like you want to.

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



[Rails] Re: Generate model from database

2011-10-20 Thread Tim Shaffer
Well you don't exactly have to do it by *hand*. It's pretty easy to write a 
script to generate the command for you. Just change table_name to whatever 
your model is...

table_name = "Post"
output = [ "rails g scaffold #{table_name} --skip-migration" ]
ignore_columns = [ 'id', 'created_at', 'updated_at' ]
table_name.constantize.columns.each do |c|
  output << "#{c.name}:#{c.type}" unless ignore_columns.include?(c.name)
end
puts output.join(" ")

returns: rails g scaffold Post --skip-migration title:string body:text 
published_at:datetime

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



Re: [Rails] Re: Generate model from database

2011-10-19 Thread Tim Shaffer
I believe you can also pass a "--skip-migration" option to scaffold so it 
won't generate the migration.

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



[Rails] Re: Fallback for CDN asset loading

2011-10-18 Thread Tim Shaffer
Gotcha. You could always create a helper for it.

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



[Rails] Re: Fallback for CDN asset loading

2011-10-17 Thread Tim Shaffer
Why not just something like this? Then you can put your dojo.js in 
assets/javascripts and compile it like normal. Seems kind of unnecessary to 
add extra logic to javascript_include_tag

<%= javascript_include_tag 
"http://ajax.googleapis.com/ajax/libs/dojo/1.6.1/dojo/dojo.xd.js"; %>

  if ( typeof(dojo) === "undefined" ) { 
script = document.createElement('script');
script.type = "text/javascript";
script.src = '<%= asset_path "dojo.js" %>';
document.getElementsByTagName('head')[0].appendChild(script);
  }


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



[Rails] Re: adding key/value pairs to hash wrongfully adds a right bracket

2011-10-17 Thread Tim Shaffer
How do you call the session_code method?

What data type are unit_id and code? And what does a typical session[:code] 
look like?

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



[Rails] Re: AJAX vote update for a nested resource

2011-10-14 Thread Tim Shaffer
That's to be expected with your HTML.

What you currently have will generate HTML that looks like the following if 
you have 3 reviews:

1 vote
2 votes
3 votes

$("#votes").html("3 votes")
$("#votes").html("4 votes")
$("#votes").html("5 votes")

See the problem?

The problem is that each paragraph tag has the same ID. jQuery will only 
update the first one. Each paragraph needs to have a unique ID, then your 
JavaScript to update the paragraph needs to update the specific unique ID.

Including the primary key in the HTML ID is a good solution:



Then your jQuery can update the specific paragraph that it needs to:

$("#review_<%= review.id %>").html("<%= review.votes_count %>")


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



[Rails] Re: how call method from model to controller in rails 3

2011-10-14 Thread Tim Shaffer
Now you have the opposite problem... You are now calling list as an instance 
method and you have it defined as a class method.

You need to do ONE of the following.

Define it as a class method, and call it as a class method:

def self.list
  code
end

@list = Sale.list

Define it as an instance method and call it as an instance method:

def list
  code
end

@list = Sale.new.list

However, based on what the list method does, it's probably best that you do 
the former and have it be a class method.

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



[Rails] Re: AJAX vote update for a nested resource

2011-10-14 Thread Tim Shaffer
You're defining @review as an instance variable, so you have to use it as 
one in the view:

$("#votes").html("<%= *@*review.votes_count %>")

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



[Rails] Re: Validates_with problem

2011-10-14 Thread Tim Shaffer
On Friday, October 14, 2011 2:53:20 AM UTC-4, Ruby-Forum.com User wrote:
>
> I have one big problem: when I try record to db through
> update_attributes! (which must save when record invalid).


I'm not so sure that's entirely accurate. Check out the API for 
update_attributes! and save! methods:

http://api.rubyonrails.org/classes/ActiveRecord/Persistence.html#method-i-update_attributes-21
http://api.rubyonrails.org/classes/ActiveRecord/Persistence.html#method-i-save-21

Specifically: update_attributes! updates its receiver just like 
update_attributes but calls save!  With save! validations always run.

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



  1   2   3   4   5   6   >