Re: [Rails] helper function in database.yml not working from rake

2015-11-19 Thread Rahoul Baruah
On Wednesday, 18 November 2015 18:46:07 UTC, tamouse wrote: > > This is for Rahoul, not the OP: > > Rails 4.1 introduced the #config_for method on the Rails application, > which makes all the reading, erbing, and yamling of config files really > super simple. You can change your above initi

Re: [Rails] helper function in database.yml not working from rake

2015-11-18 Thread Tamara Temple
Rahoul Baruah writes: > On Wednesday, 18 November 2015 09:48:38 UTC, ruud wrote: > > >> Hi Matt, >> thanks for your advice. Maybe this is an alternative in this case, but I >> would like to know how to tackle this for custom functions in general. >> I found out that if I copy the function to con

Re: [Rails] helper function in database.yml not working from rake

2015-11-18 Thread ruud
On Wednesday, November 18, 2015 at 10:57:22 AM UTC+1, Rahoul Baruah wrote: > > > So any functions I had defined within config/initializers/storage.rb > should be available to the ERB parser. > > Hi Rahoul, I am going to try that. Thanks for your help. regards, Ruud -- You received this messa

Re: [Rails] helper function in database.yml not working from rake

2015-11-18 Thread Rahoul Baruah
On Wednesday, 18 November 2015 09:48:38 UTC, ruud wrote: > Hi Matt, > thanks for your advice. Maybe this is an alternative in this case, but I > would like to know how to tackle this for custom functions in general. > I found out that if I copy the function to config/application, rake finds

Re: [Rails] helper function in database.yml not working from rake

2015-11-18 Thread ruud
On Tuesday, November 17, 2015 at 4:29:39 PM UTC+1, matt wrote: > > Why not just use an environment variable. For example, <%= > ENV[‘MY_DB_PASSWORD’] %>. Then you can export that from your specific > environment or fire up your task with the environment var set, ex: > `MY_DB_PASSWORD=letsp

Re: [Rails] helper function in database.yml not working from rake

2015-11-17 Thread Rahoul Baruah
On Tuesday, 17 November 2015 15:29:39 UTC, matt wrote: > > Why not just use an environment variable. For example, <%= > ENV[‘MY_DB_PASSWORD’] %>. Then you can export that from your specific > environment or fire up your task with the environment var set, ex: > `MY_DB_PASSWORD=letsparty rai

Re: [Rails] helper function in database.yml not working from rake

2015-11-17 Thread BuyzLots
Why not just use an environment variable. For example, <%= ENV[‘MY_DB_PASSWORD’] %>. Then you can export that from your specific environment or fire up your task with the environment var set, ex: `MY_DB_PASSWORD=letsparty rails s` > On Nov 17, 2015, at 4:20 AM, ruud wrote: > > hello group,

[Rails] helper function in database.yml not working from rake

2015-11-17 Thread ruud
hello group, in order not to have passwords stored in my database.yml, I had inserted a function that read the password from a file that is not under version control. The entry in database.yml looks like this: e: adapter: postgresql host: localhost template: template0 database: arc

Re: [Rails] Helper or ???

2012-01-26 Thread Walter Lee Davis
On Jan 26, 2012, at 11:38 AM, Peter Vandenabeele wrote: > On Thu, Jan 26, 2012 at 3:37 PM, Colin Law wrote: > ... > To me that looks more like something that should be called in the > controller and go into an @ variable for use in the view. The general > rule is setup data in the controller an

Re: [Rails] Helper or ???

2012-01-26 Thread Colin Law
On 26 January 2012 16:38, Peter Vandenabeele wrote: > On Thu, Jan 26, 2012 at 3:37 PM, Colin Law wrote: > ... > >> To me that looks more like something that should be called in the >> controller and go into an @ variable for use in the view.  The general >> rule is setup data in the controller an

Re: [Rails] Helper or ???

2012-01-26 Thread Peter Vandenabeele
On Thu, Jan 26, 2012 at 3:37 PM, Colin Law wrote: ... > To me that looks more like something that should be called in the > controller and go into an @ variable for use in the view. The general > rule is setup data in the controller and display it in the view. TL;DR * controller only does "rou

Re: [Rails] Helper or ???

2012-01-26 Thread Michael Pavling
On 26 January 2012 15:03, Colin Law wrote: > Michael: I don't think that addresses the problem, unless I > misunderstand.  The OP doesn't need the method available in the > controller *and* the view, he is just not sure about which it should > be. True... depending on where it's wanted will affec

Re: [Rails] Helper or ???

2012-01-26 Thread Walter Lee Davis
On Jan 26, 2012, at 9:51 AM, Michael Pavling wrote: > On 26 January 2012 14:47, Walter Lee Davis wrote: >> I had it in the controller, but I didn't like the look of having to declare >> an instance variable inside each method that needed this (new and create and >> edit and update). The helper

Re: [Rails] Helper or ???

2012-01-26 Thread Colin Law
On 26 January 2012 14:51, Michael Pavling wrote: > On 26 January 2012 14:47, Walter Lee Davis wrote: >> I had it in the controller, but I didn't like the look of having to declare >> an instance variable inside each method that needed this (new and create and >> edit and update). The helper was

Re: [Rails] Helper or ???

2012-01-26 Thread Michael Pavling
On 26 January 2012 14:47, Walter Lee Davis wrote: > I had it in the controller, but I didn't like the look of having to declare > an instance variable inside each method that needed this (new and create and > edit and update). The helper was there for the asking in each view, so it > seemed DRY

Re: [Rails] Helper or ???

2012-01-26 Thread Colin Law
On 26 January 2012 14:47, Walter Lee Davis wrote: > > On Jan 26, 2012, at 9:37 AM, Colin Law wrote: > >> On 26 January 2012 14:26, Walter Lee Davis wrote: >>> I have a strong handle on when to use a helper -- at least I think so. A >>> helper may include some logic (not enough to belong in the m

Re: [Rails] Helper or ???

2012-01-26 Thread Walter Lee Davis
On Jan 26, 2012, at 9:37 AM, Colin Law wrote: > On 26 January 2012 14:26, Walter Lee Davis wrote: >> I have a strong handle on when to use a helper -- at least I think so. A >> helper may include some logic (not enough to belong in the model) and it >> presents html as its output. So I have a

Re: [Rails] Helper or ???

2012-01-26 Thread Colin Law
On 26 January 2012 14:26, Walter Lee Davis wrote: > I have a strong handle on when to use a helper -- at least I think so. A > helper may include some logic (not enough to belong in the model) and it > presents html as its output. So I have a conceptual problem about this > solution that I've b

[Rails] Helper or ???

2012-01-26 Thread Walter Lee Davis
I have a strong handle on when to use a helper -- at least I think so. A helper may include some logic (not enough to belong in the model) and it presents html as its output. So I have a conceptual problem about this solution that I've built: #helpers/people_helper.rb def person_roles (%W

[Rails] Re: Accessing Rails helper method with_output_buffer

2011-09-15 Thread Gogov
Thank you very much, Frederick! I'm into my day 5 digging into Rails rendering internals (writing a plugin) but I didn't think of that. This part of Rails seems like it needs some tidying.. More questions arise but I'll try to answer them myself first. Thank you! Martin On Sep 13, 1:15 pm, Frede

[Rails] Re: Accessing Rails helper method with_output_buffer

2011-09-13 Thread Frederick Cheung
On Sep 13, 11:00 am, Gogov wrote: > Hi all, > > I cannot figure out how to correctly use the with_output_buffer helper > method (located in ActionView::Helpers::CaptureHelper) inside a custom > FormBuilder. > > Below follows a simplified example. > > I'm trying to achieve the following behavior

[Rails] Accessing Rails helper method with_output_buffer

2011-09-13 Thread Gogov
Hi all, I cannot figure out how to correctly use the with_output_buffer helper method (located in ActionView::Helpers::CaptureHelper) inside a custom FormBuilder. Below follows a simplified example. I'm trying to achieve the following behavior in an ERB as suggested in the form_for helper docs i

Aw: Re: Re: [Rails] Helper methods in coffescript files

2011-08-04 Thread robertj
Hi Noel, thanks - the question is concerning helper methods. How can I use helper methods in the asset pipeline? Best regards -- 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.goog

Re: Re: [Rails] Helper methods in coffescript files

2011-08-04 Thread Noel
sorry, had not read the full original post On Thu, Aug 4, 2011 at 5:32 AM, Noel wrote: > you can do > myfile.js.coffee.erb > > first it will be processed by ERB then CoffeeScript > > > On Thu, Aug 4, 2011 at 4:59 AM, robertj wrote: >> Hi, >> apart from the fact, that it might not be a good idea

Re: Re: [Rails] Helper methods in coffescript files

2011-08-04 Thread Noel
you can do myfile.js.coffee.erb first it will be processed by ERB then CoffeeScript On Thu, Aug 4, 2011 at 4:59 AM, robertj wrote: > Hi, > apart from the fact, that it might not be a good idea in terms of > performance ... > Is it possible? I am trying the same. > Best regards > Robert > > -- >

Aw: Re: [Rails] Helper methods in coffescript files

2011-08-04 Thread robertj
Hi, apart from the fact, that it might not be a good idea in terms of performance ... Is it possible? I am trying the same. Best regards Robert -- 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

Re: [Rails] Helper methods in coffescript files

2011-06-20 Thread Walter Lee Davis
On Jun 20, 2011, at 4:31 AM, Jonathan Borg wrote: Hi, I was wondering if there is a way to make helper methods available in my .coffe files, Im trying to generate a graph from some userdata with a javascript library, and with the new asset pipeline I can append .erb so its users.js.coffe.erb wh

[Rails] Helper methods in coffescript files

2011-06-20 Thread Jonathan Borg
Hi, I was wondering if there is a way to make helper methods available in my .coffe files, Im trying to generate a graph from some userdata with a javascript library, and with the new asset pipeline I can append .erb so its users.js.coffe.erb which works just great, but I need some way to get the c

[Rails] Helper to generate css-id from AR model. Do I have alzheimers?

2010-11-26 Thread Rick DeNatale
On one of the many Rails projects I've worked on over the years, I seem to recall using either a helper or a method on a model to generate a css id based on the model class and id. It was very useful particularly in making views more testable in RSpec/Cucumber. I can't remember if this was part o

[Rails] helper method does not include helper module into controller

2010-10-13 Thread Sophy
Hi all, I want to include helper module into controller and I tried to use helper method but it doesn't work. It actually works in Rails 2.X. For instance, I have AppletsHelper and I want to include that module in my controller. So, in my controller I would write helper :applets but still I can'

[Rails] Helper in Initializer: Is it possible ?

2010-07-06 Thread Tom Ha
Hi there, is there a way in Rails to use helpers in an Initializer ? If yes, how ? If no, where else to put the code needed in the Initializer (as well as in views) ? In the application_controller.rb ? Thanks for any hints! Tom -- Posted via http://www.ruby-forum.com/. -- You received this m

[Rails] Helper module not included on subsequent requests form engine gem in development from passenger

2010-05-03 Thread Walter McGinnis
Hi, I'm working on a Rails 2.3.5 based gem that acts as an "add-on" for an existing application. It basically pulls in functionality from another more generic gem and sets up the application to use it. In its rails/init.rb it adds some helpers to ApplicationHelper. Here's the init.rb file: http

[Rails] Helper in controller undefined when called

2009-10-31 Thread Great John
Hello, I'm pulling my hair out as I can't seem to find resolution to my simple problem, which is calling methods from controllers to helpers. in my application_controller.rb I have helper :all, which as i understand should include all helpers all the time. Then when i try to call methods in helpe

[Rails] helper for ajax field update

2009-07-22 Thread billv
I have a page that lists a set of tasks, each with a status field. I'd like the ability to update the status from this field, through a pop-up box. Basically, click the link, a little text area box opens, the user enters the update, clicks save, the box goes away and the update appears on the pag

[Rails] "Helper" for 2 controllers?

2009-04-23 Thread Heinz Strunk
Is there a DRY way to have a helper method for 2 different controllers? For example: @user.create_points_account(10) @group.create_points_account(10) and the helper method would look like this: def create_points_account pts f = PointAccount.new(:points => pts) f.resource = self return fal

[Rails] helper caching issue

2009-03-26 Thread Greg Donald
I have a helper: def pretty_datetime( dt ) dt.strftime( "%b %d, %Y %I:%m%p" ) end and I have a partial that uses the helper like this: <%= pretty_datetime alert.updated_at %> The problem is when I update the record the previous updated_at value is still being displayed. When I don't use

[Rails] Helper

2009-03-23 Thread Fresh Mix
How can I replace this with helper? <% if flash[:error] %> <%= flash[:error] %> <% end %> <% if flash[:warning] %> <%= flash[:warning] %> <% end %> <% if flash[:notice] %> <%= flash[:notice] %> <% end %> -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~

[Rails] Helper

2009-02-20 Thread James Bond
How make a helper: If value X is true: print else -- 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 rubyon

[Rails] Re: Rails Helper

2009-02-17 Thread s.ross
Newb wrote: > > hi.. > this is html generated code. > image > #1 > > is it possible to use Rails code instead of the above one. > if possible to use Rails helper means which would generate html code > like above > -- > Posted via http://www.ruby-forum.com/. > >

[Rails] Rails Helper

2009-02-17 Thread Newb Newb
hi.. this is html generated code. image #1 is it possible to use Rails code instead of the above one. if possible to use Rails helper means which would generate html code like above -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received

[Rails] Re: How to give onchange for select_year rails helper....

2009-01-29 Thread Luke Pearce
rails and rails only wrote: > <%=select_year(Date.today,:include_blank=>true, :start_year => > Date.today.strftime("%Y").to_i, :end_year => 1999)%> > > i am using rhis helper... now i want to give onchange here If you check out the api: http://api.rubyonrails.org/classes/ActionView/Helpers/

[Rails] How to give onchange for select_year rails helper....

2009-01-28 Thread rails and rails only
<%=select_year(Date.today,:include_blank=>true, :start_year => Date.today.strftime("%Y").to_i, :end_year => 1999)%> i am using rhis helper... now i want to give onchange here Please help me to solve this thanks in advance JK -- Posted via http://www.ruby-forum.com/. --~--~---

[Rails] helper for model?

2009-01-14 Thread Pardee, Roy
Hey All, I find I'm writing a ton of nearly identical model methods to support mass creation/update of child objects (a la the 'complex forms' series of railscasts). Stuff like: def existing_child_attributes=(updated_kids) children.each do |kid| unless kid.new_record? atts

[Rails] Helper methods from controller

2008-10-05 Thread Jon Stenqvist
Hi, I'm not sure i'm my design is correct, but i have around_filter in the controller, where i want to add a small javascript at the end of the page. Is there someway i can use the javascript_tag from the controller? i though there where a helpers proxy available. /Jon -- Posted via http://www.

[Rails] helper method problem

2008-09-27 Thread Jon
In my main controller have: def index @albums=Album.find(:all) @cart=find_cart end since find_cart is also used by another controller, I decided to move it from to the application_helper.rb file too reduce redundancy. Rails is throwing an error saying that there is no method

[Rails] helper method with block--with list iteration?

2008-09-08 Thread Jonathan Rochkind
I'd like to use the helper method with block technique, but I can't seem to make it work the way I want with a list. I'm imagining something like this: <% decorate_list_with_max(list, 5) do |item| %> Here's the item name: <%= item.name %> <% end %> decorate_list_with_max(list, max, &block) {