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
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
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
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
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
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
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,
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
>
> --
>
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
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
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
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
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'
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
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
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
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
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
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
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/.
--~--~-~--~~~
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
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/.
>
>
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 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/
<%=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/.
--~--~---
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
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.
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
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) {
46 matches
Mail list logo