Re: [Rails] Re: How to "intercept" each action call?

2012-05-11 Thread Lauro Caetano
Thank very much for all your help =) @Jeremy the #2 is awesome :) @Dheeraj your point of view is really coll too! And yes! I would like to get some help to get this gem done. I've created a github repo at: https://github.com/laurocaetano/injector At time, sorry for my really bad english =( Th

[Rails] Re: How to "intercept" each action call?

2012-05-11 Thread Dheeraj Kumar
@Jeremy: #1 seems to be the easiest, but #2 is the best solution. Here's my view of how this can work: class TasksController < ApplicationController # Specify which class has the generic scaffolding methods scaffold :my_custom_scaffold_class # or we bundle a generic class with

[Rails] Re: How to "intercept" each action call?

2012-05-11 Thread Dheeraj Kumar
I understand. See the link I posted, where the OP does exactly your requirement. Here's some code: class ApplicationController < ActionController::Base include MyGem end class TasksController < ApplicationController before_filter :find_task def find_task @task = Task.find(params[:i

Re: [Rails] Re: How to "intercept" each action call?

2012-05-11 Thread Jeremy Walker
On 12 May 2012 02:07, Lauro Caetano wrote: > I'm trying to do this: > > class ApplicationController < ActionController::Base > include MyGem > end > > class TasksController < ApplicationController >injector_to :task > > def show > respond_with(@task) > end > end > OK, so you're try

Re: [Rails] Re: How to "intercept" each action call?

2012-05-11 Thread Lauro Caetano
I'm trying to do this: class ApplicationController < ActionController::Base include MyGem end class TasksController < ApplicationController injector_to :task def show respond_with(@task) end end When the action 'show' is called, the "injector_to" should inject the @task for me. In o

[Rails] Re: How to "intercept" each action call?

2012-05-11 Thread Dheeraj Kumar
I don't understand your exact request, but let's see if this helps you. You can run filters before every action call. Inside the filter method/class, you can call your gem's methods. Also, they can modify the params hash. See this for two examples, one showing a filter method, and another a fi

Re: [Rails] Re: How to "intercept" each action call?

2012-05-11 Thread Jeremy Walker
On 12 May 2012 01:48, Lauro Caetano wrote: > Thanks for your help Dheeraj, but I'm trying to do something like > Responders. > > Responders has a respond_to :html in controllers, that is used in each > action call to respond_with. > > The thing is: call a specific method that is located inside my

Re: [Rails] Re: How to "intercept" each action call?

2012-05-11 Thread Lauro Caetano
Thanks for your help Dheeraj, but I'm trying to do something like Responders. Responders has a respond_to :html in controllers, that is used in each action call to respond_with. The thing is: call a specific method that is located inside my gem for every action call. This method should be able to

[Rails] Re: How to "intercept" each action call?

2012-05-11 Thread Dheeraj Kumar
You need a before_filter. http://edgeguides.rubyonrails.org/action_controller_overview.html#filters Dheeraj Kumar On Saturday 12 May 2012 at 5:53 AM, Lauro Caetano wrote: > Hi! > > I'm a RoR beginner and I'm trying to make a gem that can "intercepts" all > action from my controllers. > >

[Rails] Re: How to "intercept" each action call?

2012-05-11 Thread Dheeraj Kumar
You need a before_filter. http://edgeguides.rubyonrails.org/action_controller_overview.html#filters Dheeraj Kumar On Saturday 12 May 2012 at 5:53 AM, Lauro Caetano wrote: > Hi! > > I'm a RoR beginner and I'm trying to make a gem that can "intercepts" all > action from my controllers. > >

[Rails] Re: How to "intercept" each action call?

2012-05-11 Thread Dheeraj Kumar
You need a before_filter. http://edgeguides.rubyonrails.org/action_controller_overview.html#filters Dheeraj Kumar On Saturday 12 May 2012 at 5:53 AM, Lauro Caetano wrote: > Hi! > > I'm a RoR beginner and I'm trying to make a gem that can "intercepts" all > action from my controllers. > >

[Rails] How to "intercept" each action call?

2012-05-11 Thread Lauro Caetano
Hi! I'm a RoR beginner and I'm trying to make a gem that can "intercepts" all action from my controllers. I would like to do something like that: class ApplicationController < ActionController::Base include MyGem end class MyController < ApplicationController do_something_to :some_attribute

[Rails] Re: out of memory (java heap space) on zip creation (jruby)

2012-05-11 Thread Jedrin
It's late Friday and I am done for the day, but I just tried something else. It may be that I need to open the file in binary mode and I didn't. Initial tests seem to indicate that may be the case. Thanks for everyone's help. -- You received this message because you are subscribed to the Google G

[Rails] How to log session variables in Rails 3.2?

2012-05-11 Thread Chirag
Rails 3.2 introduced tagged logging, is it possible to log session variables like session[:user_id] using that? Tried adding that using a lambda, but session is not decrypted when the logger middleware is called. Is there any other way to get the session variables logged against each line that

[Rails] Re: warning: regexp match /.../n against to UTF-8 string

2012-05-11 Thread Erwin
[SOLVED] not related to UTF-8 , but rather to a script in my lib performing a wrong transliteration value = aString.mb_chars.normalize(:kd).gsub(/[^\x00-\x7F]/n, '').to_s # replace non-ASCII this is not needed anymore, using Rails 3 I can replace accentuated characters with : name.parameteri

[Rails] Re: out of memory (java heap space) on zip creation (jruby)

2012-05-11 Thread Jedrin
I changed the putc about to a write in the above post, followed by zos.print "" at the very end. print() adds $\ to the file it appears. My byte size of the zip file inside the zip was short by two bytes and I still get corrupted zip file errors on that. -- You received this message because you

[Rails] Re: out of memory (java heap space) on zip creation (jruby)

2012-05-11 Thread Jedrin
> As I mentioned in my previous reply and similar to the problem you had when > creating the file: you're trying to load the whole thing. > > There are two options for this: > > A) You stream the contents of your CSV file, reading by chunks into a > ZipStream > That's exactly what I would like t

[Rails] Re: Complex sorting question, or not?

2012-05-11 Thread Robert Walker
Chris Klimek wrote in post #1059910: > I have a function that displays all depts and related info from other > tables in my Department model, such as: > > def dept_and_hospital > "#{name} (#{floor.building.hospital.name})" > end > > ... which is used in my view, like: > > > <%= f.lab

[Rails] Get user firstname; lastname in google api through authlogic-connect

2012-05-11 Thread dinesh singh
Hello, I am using authlogic-connect 0.0.6 version in ruby on rails. I am able to get the google user email id, but not able to get the firstname and lastname. i am using the follwing code: @google ||= JSON.parse(token.get("https://www.googleapis.com/oauth2/v1/userinfo#profile";).body) however i

[Rails] Re: Re: Rails 3.2.3 not including javascript

2012-05-11 Thread Robert Walker
Colin Law wrote in post #1060321: > On 10 May 2012 15:11, beau trepp wrote: >> I'll try installing an older version of ruby then. Seems odd, I use RVM, and >> I generally aim for stable so wasn't expecting that to happen. > > I don't quite understand what you are saying here. Do you mean that > y

[Rails] Re: polymorphic associations or has_many?

2012-05-11 Thread Robert Walker
Msan Msan wrote in post #1060411: > Tell me if this is correct: > > I have a Shop, a Bar and OtherShop. > Everyone have a Category. > So I can create a polymorphic association: > > Shop has_many :categories, :as => categorization > Bar has_many :categories, :as => categorization > OtherShop has_man

[Rails] polymorphic associations or has_many?

2012-05-11 Thread Mauro
Tell me if this is correct: I have a Shop, a Bar and OtherShop. Everyone have a Category. So I can create a polymorphic association: Shop has_many :categories, :as => categorization Bar has_many :categories, :as => categorization OtherShop has_many :categories, :as => categorization Category be

Re: [Rails] JQuery + Coffeescript

2012-05-11 Thread Werner Laude
Am 10.05.2012 um 14:07 schrieb Frederick Cheung: Thanks Fred.. great.. > > > $.get 'search', {query: $('#query').val() }, (data) -> > ... > > would pass the value of the field with id query (and since this code > is being called from the change event handler attached to the text > field, you

[Rails] warning: regexp match /.../n against to UTF-8 string

2012-05-11 Thread Erwin
[Rails 3.2.3 / Ruby 1.9.3 I18n.locale :fr .. => accentuated characters => need UTF-8) It's very annoying that I need to place an ' # encoding: utf-8' at the beginning of most of my Rails script files ... I can understand when using strings w accentuated characters in yaml files, but I just foun

[Rails] Re: Adobe Air and Rails

2012-05-11 Thread cipher_neo
Thanks for the help guys. The webkit build that bundles with AIR doesn't support Web Sockets or the localStorage which we depend on, so it looks to be a dead end. I had a look at the solutions mentioned above. I am looking into using webkit.net to build a custom version of webkit that will s

[Rails] Opportunity for Ruby On Rails Developer

2012-05-11 Thread Roshani Rathod
SapnaSolutions is looking to add a rails developer to their in-house development team. We’re looking for someone who wants to hone their Rails skills on challenging projects while learning from web development experts. Some Rails experience is required but it’s far from the most important factor. W

[Rails] Re: Re: Re: Re: Rails Tutorial 3 attribue unknown

2012-05-11 Thread Sergey Ezhov
vishal singh wrote in post #1060022: > In users table their is wrong field name i.e password_digest,it should > be > only password not password_digest Someone mentioned 'password_digest'? Only 'password' and 'password_confirmation'. -- Posted via http://www.ruby-forum.com/. -- You received th

Re: [Rails] Is it suitable using STI?

2012-05-11 Thread Mauro
On 11 May 2012 09:12, Mauro wrote: > Sorry for my ignorance, in your example have you forgot Activity model > and activities table? ok, sorry they don't need. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send e

Re: [Rails] Is it suitable using STI?

2012-05-11 Thread Mauro
Sorry for my ignorance, in your example have you forgot Activity model and activities table? On 10 May 2012 17:37, Jeremy Walker wrote: > > > On 10 May 2012 16:26, Mauro wrote: >> >> On 10 May 2012 17:05, Greg Akins wrote: >> > >> > >> > On Thu, May 10, 2012 at 10:57 AM, Mauro wrote: >> >> >