Um, deviating a little from your particular concern (which may or may not be
justified), but you really can’t complain about being forced to include a gem
multiple times when you’re including action view (and thus active support,
I18n, TZInfo, builder, erubis, and a couple more…) *just* to use
You need to have a deeper understanding of ruby, and specifically the magic
of the splat (*) operator.
I think you missed that the method signature is `def find_by_sql(sql, binds =
[])`, and not `def find_by_sql(sql, *binds)`. There’s no splat in the method
signature.
Before trying to
By requiring active_support/duration you’re already forcing core extensions
on your users. Take a look at
https://github.com/rails/rails/blob/master/activesupport/lib/active_support/duration.rb#L1-L2
(And if you look at those files, they in turn require even more things from
core_ext).
Would core accept a patch that exposes helper methods (that don’t depend on
ActionView state) via module_function?
The particular use case is that I have other objects that from time to time
need access to a single helper method (like, say, #truncate). Including the
entire TextHelper seems a
Ok, I’ll take a look at this over the weekend.
Thanks,
-foca
On Fri, Sep 12, 2014 at 1:43 PM, Matthew Draper matt...@trebex.net
wrote:
On 12 Sep 2014, at 23:01, Nicolás Sanguinetti h...@nicolassanguinetti.info
wrote:
I would much rather do `ActionView::Helpers::TextHelper.truncate
You can pass Arrays to the `class:` option and it will do what you expect
it to:
link_to(post.title, post, class: [post, active if post.active?])
Cheers,
-foca
On Wed, Mar 5, 2014 at 1:36 PM, Stefan Schüßler sos...@gmail.com wrote:
When dealing with conditional class attribute values in
Sorry, it should be [post, post.active? active]
On Wed, Mar 5, 2014 at 3:23 PM, Stefan Schüßler sos...@gmail.com wrote:
That array syntax is invalid.
On Wednesday, March 5, 2014 6:16:01 PM UTC+1, Nicolás Sanguinetti wrote:
You can pass Arrays to the `class:` option and it will do what you
? I'm thinking of passing a parameter to the comments method.
class Post
has_many :comments
def comments(show_hidden = false)
show_hidden ? super : super.visible
end
end
Is this the right way?
--
Dheeraj Kumar
On Wednesday 22 May 2013 at 6:34 AM, Nicolás Sanguinetti wrote
IIRC with Rails 4 associations introduce their methods via a module, which
means you can `super` to them, so why not:
class Post
has_many :comments
def comments(*)
super.visible
end
end
I'm not too keen on having moar DSL when defining a simple method suffices.
It also gives you more
What's wrong with Model.update_all('column1 = column2 + column3') ?
This has been possible since forever :)
Cheers,
-foca
On Fri, Jan 4, 2013 at 6:46 AM, Radu Dinca radudi...@gmail.com wrote:
I would like to be able to do the following :
UPDATE table SET column1 = column2 + column3 - for the
If, for whatever reason, it makes sense to have a HelpersController in your
app, now you have a name clash and have to work around it.
IMHO there's nothing wrong with app/helpers per se. If you think the
problem is a lack of documentation, that would be the place to improve :)
Cheers,
-foca
On
-1 for the merge.
+1 for a doc fix where this is more explicit.
I've always used x.becomes(Foo) for the side effect (mutating x)
instead of for the return value.
As I see it, the name _becomes_ clearly states that the receiver is
affected. If it was #convert or #cast or something that would
On Tue, Jul 17, 2012 at 9:59 AM, David Rubin david...@gmail.com wrote:
HI Guys,
I recently tried VERY hard to override the database configuration bassed on
ENV vars or actual API calls. This task is almost next to impossible.
I know that the database.yml file is parsed as ERB but that is
On Thu, Jul 12, 2012 at 1:38 PM, Xavier Noria f...@hashref.com wrote:
On Thu, Jul 12, 2012 at 6:29 PM, Rodrigo Rosenfeld Rosas
rr.ro...@gmail.com wrote:
This is interesting. A while ago I was asking exactly the opposite: to
replace api.rubyonrails.org by the version generated with rake
On Tue, Jul 10, 2012 at 12:36 PM, Kurt Werle k...@circlew.org wrote:
On Monday, July 9, 2012 12:10:07 PM UTC-7, Nicolás Sanguinetti wrote:
dup doesn't take arguments because in ruby dup doesn't take arguments. It
wouldn't make sense to break the semantics of ruby just for this, IMO.
I had
On Mon, Jul 9, 2012 at 4:22 PM, Francesco Rodriguez
lrodriguezs...@gmail.com wrote:
What about initialize_dup?
What about it?
-f
El jul 9, 2012 2:11 p.m., Nicolas Sanguinetti godf...@gmail.com
escribió:
dup doesn't take arguments because in ruby dup doesn't take arguments. It
wouldn't
On Thu, Mar 8, 2012 at 4:38 PM, Geoff Harcourt geoff.harco...@gmail.com wrote:
I would be in favor of either of these two options. I imagine extracting and
gem-ifying the controllers would be a hassle, but then the default path for
setting up a new view and controller action would require the
On Mon, Feb 27, 2012 at 11:15 AM, Paul Gillard paulmgill...@gmail.com wrote:
Two that spring to mind are:
validates :auth_code, :absence = true, :unless = :payment_complete?
If the auth_code is something that won't be set until you get a
response from your payment gateway, then why bother with
On Mon, Dec 19, 2011 at 11:56 PM, Steve Klabnik st...@steveklabnik.com wrote:
throw/catch for flow control is bad.
Indeed it is. It's the one thing in Sinatra I always disliked.
If I had to choose, I would go down the path of render/redirect
returning a response, so you would do something like
Rails never quite followed SemVer (call it what you will), though.
-foca
On Tue, Nov 15, 2011 at 12:01 PM, Prem Sichanugrist sikand...@gmail.com wrote:
Again, that is irrelevant. It is a *patch* release, noting should be
breaking. If something break:
1. We're doing it wrong. That mean some
On Wed, Aug 31, 2011 at 3:10 PM, Wael Nasreddine
wael.nasredd...@gmail.com wrote:
+1 too, jasmine for unit testing and capybara for integration tests
Well… make Jasmine optional and I'm a happy camper :)
Regards,
Wael
--
Wael Nasreddine
Sent from my iPhone
On Aug 31, 2011, at 19:46,
And actually, `bundle update rails`. You don't want bundler updating
all the gems :)
On Thu, Apr 14, 2011 at 8:23 PM, Rodrigo Rosenfeld Rosas
rr.ro...@gmail.com wrote:
Em 14-04-2011 19:03, Santiago Pastorino escreveu:
...Simply update your Gemfile to point at the rails version 3.0.7.rc1,
then
Lots of technologies are not directly supported by the core team, and
yet are widely used by the community, for short and long-term
projects. To cite a few: Redis, Haml, MongoDB…
The biggest changes in Rails 3 (IMHO) are about ease of extension and
increased compatibility with 3rd party tools.
On Wed, Feb 16, 2011 at 10:15 PM, Ernie Miller er...@metautonomo.us wrote:
(off topic: this discussion is good to see, as I will be taking it into
account on the metawhere rewrite)
So, since this thread and another are currently ongoing relating to complex
queries and the handling of ARel
On Sat, Feb 12, 2011 at 6:40 AM, Mathijs bluescreen...@gmail.com wrote:
On Feb 12, 8:05 am, Michael Koziarski mich...@koziarski.com wrote:
CSRF attacks are about using *session* data to perform an action
without the user's knowledge. The attack you're describing here,
which doesn't rely on
Is there a case where you *wouldn't* want to pass unique: true?
Cheers,
-foca
On Thu, Oct 28, 2010 at 7:56 AM, Christiaan Van den Poel
christiaan.vandenp...@gmail.com wrote:
Hello,
I've created a small patch wherein I've added an extra parameter to the
'javascript_include_tag' (:unique =
On Tue, Sep 21, 2010 at 11:51 AM, Ryan Bigg radarliste...@gmail.com wrote:
I had a crazy idea today based off a reader's question[1].
Why are rake db:migrate and rake db:test:prepare two different tasks? Why
can't we have rake db:migrate migrate both the development and the test
database at
On Tue, Sep 21, 2010 at 1:06 PM, Ryan Bigg radarliste...@gmail.com wrote:
Some test tools such as Cucumber (and I'm sure I've seen it in RSpec but I
cannot reproduce it right now) do not run the migrations before they run the
tests. I think Rails should automatically do it so that when you run
Aand this is getting a bit off-topic. If you guys want to
fight, that's fine, I'll get some popcorn, a boxing ring, and a bell
to signal the rounds. But it's probably better not to do it on this
list ;)
Cheers
On Mon, Jul 5, 2010 at 1:22 PM, Rodrigo Rosenfeld Rosas
rr.ro...@gmail.com
On Sat, Jul 3, 2010 at 5:04 PM, Yehuda Katz wyc...@gmail.com wrote:
The only way to do this in a pure Ruby way is to poll all the files in a
thread. I'm not sure if this would be more or less performant. We tried this
in Merb and people were annoyed by the constant CPU usage (3-10%) used by
On Fri, May 14, 2010 at 12:22 AM, Neeraj Singh neerajdotn...@gmail.com wrote:
class Brake
scope :good, where(:quality = 'good')
end
Brake.all.select :nil? #= works fine
Brake.good.select :nil? #= FAILS
Last statement fails because Brake.good.select is returning
ActiveRecord::Relation and
On Fri, Apr 9, 2010 at 10:10 AM, Anuj Dutta dutta.a...@googlemail.com wrote:
On 9 April 2010 16:56, Joao Carlos m...@joao-carlos.com wrote:
I just came across a situation where it would be extremely handy to
have a method that returns the receiver.
Imagine the following example:
filter =
On Fri, Apr 9, 2010 at 4:31 PM, Joao Carlos m...@joao-carlos.com wrote:
I'll admit mine was a bad example. However, the most common (only?)
use case I could see for it is in fact with #send.
Your idea for filtering is great, by the way.
Instead of send you can use instance_eval. Where you'd
On Sun, Mar 21, 2010 at 7:23 AM, michael.hasenst...@googlemail.com
michael.hasenst...@googlemail.com wrote:
Hi,
I always found one thing severely missing from Rails' partials: an
equally easy Rails way to not just share view templates easily even
across controllers, but also have certain
On Sat, Feb 20, 2010 at 2:36 PM, Joe Fiorini j...@faithfulgeek.org wrote:
Would appreciate any thoughts/feedback on my ticket/patch.
When are the routes initialized now? Some routes may depend on gems
being loaded (like devise, for example)
Nice.
I'm not sure I understand the new API though. You define instance
methods but call class methods? Also, what's that magic recipient
parameter we never pass in? Why not just define class methods? Eg:
class Notifier ActionMailer::Base
delivers_from(sys...@example.com)
def
On Tue, Jan 12, 2010 at 12:50 AM, Pito pitosa...@gmail.com wrote:
I've tried to answer this myself, with my friends and on the rails
list. No joy,
I got to thinking that something subtle changed between rails 2.3.x
and 2.3.5 which I don't know about.
I am troubleshooting a weird scenario
On Tue, Jan 5, 2010 at 12:19 PM, José Valim jose.va...@gmail.com wrote:
I think that the main reason to do so by default, is to avoid issues
like people setting nested attributes, but the attribute is protected
and then the assignment never work.
If this is the case, I would prefer to have a
On Tue, Dec 15, 2009 at 11:54 PM, Ryan Bigg radarliste...@gmail.com wrote:
So far, from my understanding, what you've said is that you want to use
some parts of ActiveSupport, but you don't want to use the entire
ActiveSupport collection. It would be helpful to us if you could name
the parts
On Mon, Oct 26, 2009 at 7:17 AM, Henrik N hen...@nyh.se wrote:
Since our users have been complaining about putting 1 234 in a form
and having 1 stored instead of 1234 (because of how to_i/to_f works),
I made a simple monkeypatch to get their expected behavior:
This is not something that
2009/10/11 Carlos Júnior car...@milk-it.net:
Maybe a simple wiki page with a table listing the currently supported
template engines and it's features is enough. One of these features
would obviously be XSS safe
On Mon, 2009-10-12 at 10:14 +1300, Michael Koziarski wrote:
On Mon, Oct 12,
On Fri, Sep 4, 2009 at 8:50 AM, Mislav
Marohnićmislav.maroh...@gmail.com wrote:
On Thu, Sep 3, 2009 at 19:32, Chad Woolley thewoolley...@gmail.com wrote:
3. Help fix the build :)
If there are three commits—A, B and C, where A breaks the build and B,C are
unrelated—I'm wondering why should
, Mike Gunderloy wrote:
On Sep 4, 2009, at 7:30 AM, Nicolás Sanguinetti wrote:
Don't forget the build is broken, thus, spam you with emails until
someone drags his ass over and fixes the build
The problem with the spam emails approach is that people will treat
them as spam. I don't know what
On Mon, Aug 10, 2009 at 9:31 AM, Albert Llopmrs...@gmail.com wrote:
On mislav's comment I just have to add that it makes no sense to use b
when you can use label, and if you want the scaffold to have labels show
bold, then use css.
Also, personally don't think you need any extra markup at
+1 for using button_to instead of link_to.
And if submit_tag were to generate a button instead of an input
then +100 :)
-foca
On Mon, Aug 10, 2009 at 9:37 AM, Mislav
Marohnićmislav.maroh...@gmail.com wrote:
On Mon, Aug 10, 2009 at 13:58, Yehuda Katz wyc...@gmail.com wrote:
Are you
On Fri, Jul 31, 2009 at 7:43 PM, Michael Koziarskimich...@koziarski.com wrote:
if the column is unique-constrained, you should use find_by_column (or
`first` with conditions or scope);
if the column is not unique, you must use find_all_by_column (or
alternatives);
there's no need for an
On Wed, May 20, 2009 at 2:30 PM, Michael Schuerig mich...@schuerig.de wrote:
On Wednesday 20 May 2009, RSL wrote:
Merb was always putting out this line about how Rails had no public
API. I found it laughable at first because
http://api.rubyonrails.org/ seemed to obviously refute this.
47 matches
Mail list logo