[Rails] (Beginner) Finding a database object within a time interval

2011-05-08 Thread Anders_P
Hello, I'm trying to create a find statement that should find an element which start_date and end_date are within Time.now. If I for example have an object with a start_date of 2011-05-04 and end_date of 2011-05-19, the find statement should find the elment(s) that are within that time peroid. My

[Rails] Re: (Beginner) Finding a database object within a time interval

2011-05-08 Thread Anders_P
}'. Thanks! // Anders On May 8, 5:13 pm, Frederick Cheung frederick.che...@gmail.com wrote: On 8 May 2011, at 13:58, Anders_P and...@andersplanting.se wrote: Hello, I'm trying to create a find statement that should find an element which start_date and end_date are within Time.now. If I

[Rails] Re: (Beginner) Finding a database object within a time interval

2011-05-08 Thread Anders_P
Thanks for the tip, got a bit cleaner. On May 8, 8:02 pm, Frederick Cheung frederick.che...@gmail.com wrote: On 8 May 2011, at 18:51, Anders_P and...@andersplanting.se wrote: Thanks for your answer, I think I got it to work. def current_tee  current_time = Time.now  @current_tee

[Rails] (Beginner) Learning Rspec (help!)

2011-04-23 Thread Anders_P
Hello! I'm trying to make a simple test. I have a coming soon page with a field where users can submit their emails. When the users clicks submit it should create a new record in the database. I Have two controllers: class PagesController ApplicationController def home

[Rails] Re: (Beginner) Learning Rspec (help!)

2011-04-23 Thread Anders_P
Ouch embarrassing. :D Thanks! On 23 Apr, 22:15, Frederick Cheung frederick.che...@gmail.com wrote: On Apr 23, 8:58 pm, Anders_P and...@andersplanting.se wrote: Hello! And: class NewsletterReceiversController ApplicationController   def create     @newsletter_receiver

[Rails] Re: PayPal notifications - Rails 3.

2010-12-08 Thread Anders_P
Thanks Colin! You found the root of my problem, the invoice/id was wrong. And thanks for the tips regarding Ruby-debug. Still has a lot to learn. :D // Anders On 7 Dec, 22:35, Colin Law clan...@googlemail.com wrote: On 7 December 2010 21:03, Anders_P and...@andersplanting.se wrote

[Rails] PayPal notifications - Rails 3.

2010-12-07 Thread Anders_P
Hello! I'm trying to integrate PayPal into my (first) Rails app. I've been looking at RailsCast #142, http://railscasts.com/episodes/142-paypal-notifications. But I don't get it to work. My app isn't a normal e-commerce site, it's a buy and sell site. Every ad has a 'published' boolean, which I

[Rails] Re: Newbie - Rails 3 authentication question (Devise)

2010-11-09 Thread Anders_P
Hi! Thanks for your help. I took the Devise route, it was a bit of hassle but it works now. Thanks // Anders On 31 Okt, 23:09, Peter De Berdt peter.de.be...@pandora.be wrote: On 31 Oct 2010, at 22:52, Colin Law wrote: I'm working on my first Rails app and I have a question regarding

[Rails] |Newbie] Change default locale I18n file devise.

2010-11-03 Thread Anders_P
Hello! This is probably something easy. I've looked at some documentation but I didn't find any good resources on how to change to default locale file with Devise authentication plugin. Should I do it in my application controller or should I change something in Devise? And how should I do it.

[Rails] Newbie - Rails 3 authentication question (Devise)

2010-10-31 Thread Anders_P
Hello! I'm working on my first Rails app and I have a question regarding authentication. I already have authentication for signing up, logging in, logging out, etc. What I need is an account email activation function and a reset password (forgot password) function. I have read a little bit about

[Rails] Re: Newbie - Rails 3 lightbox?

2010-10-19 Thread Anders_P
. Walter On Oct 15, 2010, at 4:05 PM, Anders_P wrote: I'm getting this error from Firebug. uncaught exception: Page Type could not be determined, please amend this lightwindow URLhttp://localhost:3000/system/images/301/original/tufftroja_19225958.j... I use Paperclip for uploading

[Rails] Re: Newbie - Rails 3 lightbox?

2010-10-19 Thread Anders_P
Hi again! Sorry, newbish misstake. I had forgotten to replace my old prototype file with the file from lightwindow, so now it works! Thanks again! // Anders On 19 Okt, 18:06, Anders_P and...@andersplanting.se wrote: Thanks, that seemed to work. But I ran into another problem. The effect

[Rails] Newbie - Rails 3 lightbox?

2010-10-15 Thread Anders_P
Hello! I'm trying to create a simple image popup effect using Lightbox2, http://www.huddletogether.com/projects/lightbox2/. But I don't get it to work. My code looks lite this: span class=ad_image a href=%= ad.image.url(:thumb) % rel=lightboximg src=%= ad.image.url(:thumb) % //a /span This

[Rails] Re: Newbie - Rails 3 lightbox?

2010-10-15 Thread Anders_P
does the initial hookup. Walter On Oct 15, 2010, at 11:24 AM, Anders_P wrote: Hello! I'm trying to create a simple image popup effect using Lightbox2, http://www.huddletogether.com/projects/lightbox2/. But I don't get it to work. My code looks lite this: span class=ad_image

[Rails] Re: Newbie - Rails 3 lightbox?

2010-10-15 Thread Anders_P
, 2010, at 11:58 AM, Anders_P wrote:  class=lightbox -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk

[Rails] Re: Newbie - Rails 3 lightbox?

2010-10-15 Thread Anders_P
, 2010, at 11:58 AM, Anders_P wrote:  class=lightbox -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk

[Rails] Re: Newbie - Rails 3 lightbox?

2010-10-15 Thread Anders_P
  getting any errors? Walter On Oct 15, 2010, at 1:47 PM, Anders_P wrote: Hi, I think we were talking about different modal window plugins. But I've changed to LightWindow now, it seems much better. I'm now getting the same output as you from my source code, span class=ad_image

[Rails] Newbie - Create menu and send parameters to controller from view.

2010-10-09 Thread Anders_P
Hello! I'm trying to create a menu. I have a controller that takes two attributes, like this: def category(gender, category) @ads = Ad.find_all_by_gender_and_category(gender, category).paginate(:page = params[:page]) @title = Startsidan render 'home' end And in my view I have a list with

[Rails] Re: Newbie - Create menu and send parameters to controller from view.

2010-10-09 Thread Anders_P
get any errors, but it doesn't find anything. Any idea on what might be wrong? // Anders On 9 Okt, 17:23, David Kahn d...@structuralartistry.com wrote: On Sat, Oct 9, 2010 at 7:41 AM, Anders_P and...@andersplanting.se wrote: Hello! I'm trying to create a menu. I have a controller that takes

[Rails] Re: Newbie - Create menu and send parameters to controller from view.

2010-10-09 Thread Anders_P
...@structuralartistry.com wrote: On Sat, Oct 9, 2010 at 11:13 AM, Anders_P and...@andersplanting.se wrote: Hi! Thanks for your help. But I still doesn't get it to work. I've changed the controller action so it looks like:  def category     gender = params[:gender]    category = params[:category]     @ads

[Rails] Re: Newbie - Create menu and send parameters to controller from view.

2010-10-09 Thread Anders_P
Thanks for your tips, I think I will follow your suggestion and create a new model 'Category', think it will get a lot cleaner. Thanks. // Anders On 9 Okt, 19:37, David Kahn d...@structuralartistry.com wrote: On Sat, Oct 9, 2010 at 12:17 PM, Anders_P and...@andersplanting.se wrote: Hi

[Rails] Newbie - submit_tag with link?

2010-10-03 Thread Anders_P
Hello! I have a systemwide search field with a submit button (submit_tag). Like so: %= submit_tag Search % I wonder if there is a way to link to a chosen path when the user presses the submit button, in my case to the root_path. Or should i use something else instead of 'submit_tag'? I have

[Rails] Re: Newbie - submit_tag with link?

2010-10-03 Thread Anders_P
id=search         %= link_to(Show All) if params[:q] %         %= text_field_tag :q, params[:q] %         %= submit_tag Search, :name = nil, :id = 'search_submit' % /div % end % Walter On Oct 3, 2010, at 8:33 AM, Anders_P wrote: Hello! I have a systemwide search field with a submit

[Rails] Re: Newbie - submit_tag with link?

2010-10-03 Thread Anders_P
on JavaScript on the client   to keep from submitting the default value. Be sure to check in your   controller for that explicit value and ignore the search event in that   case. Walter On Oct 3, 2010, at 12:18 PM, Anders_P wrote: Thanks a lot! That worked. Do you have any tips on my second

[Rails] [Newbie] Require old password when changing it (Rails 3).

2010-10-01 Thread Anders_P
Hello! I'm trying to create a user update action, and I want to check so that the user has entered his correct old password before changing it. I've been googeling for a while but I can't find any good tips. I'm thinking of adding a 'old password' column to my User model but I don't know if

[Rails] Re: Couldn't find User without an ID

2010-09-12 Thread Anders_P
of your  so params[:id] has nothing in it thats why Couldn't find User without an ID On Sat, Sep 11, 2010 at 2:08 PM, Anders_P and...@andersplanting.se wrote: Thanks for your tips Colin! Hi radhames! Thanks for your help on my previous topic. Here is my routes.rb file:  resources

[Rails] Re: Couldn't find User without an ID

2010-09-12 Thread Anders_P
, 2010 at 7:48 AM, Anders_P and...@andersplanting.se wrote: Hi radhames! So the problem lies in my routes!?!, do you have any suggestion on how it should look? Thanks! // Anders On 12 Sep, 04:48, radhames brito rbri...@gmail.com wrote: ok there is a problem @user = User.find

[Rails] Couldn't find User without an ID

2010-09-11 Thread Anders_P
Hello! I'm trying to create a list of user ads on my home page in my app. But I don't get it to work. I'm a rails noob so it might be something trivial. I'm currently running into this error: Couldn't find User without an ID My pages controller where to home action is looks like this: def

[Rails] Re: Couldn't find User without an ID

2010-09-11 Thread Anders_P
, 12:43, Colin Law clan...@googlemail.com wrote: On 11 September 2010 11:34, Anders_P and...@andersplanting.se wrote: Hello! I'm trying to create a list of user ads on my home page in my app. But I don't get it to work. I'm a rails noob so it might be something trivial. I'm currently

[Rails] Re: Couldn't find User without an ID

2010-09-11 Thread Anders_P
to be a member restful action and it needs an id to find the record but you are not declaring that route the right way show the routes please On Sat, Sep 11, 2010 at 8:25 AM, Colin Law clan...@googlemail.com wrote: On 11 September 2010 12:14, Anders_P and...@andersplanting.se wrote: Could

[Rails] Create and render a flash message partial?

2010-09-08 Thread Anders_P
Hello! I'm trying to create a partial for flash messages and render it to my views, but I don't get it to work. My code looks like this: # _flash.html.erb % flash.each do |key, value| % %= content_tag(:div, value, :class = flash #{key} body_copy box_padding) % % end % And in my views:

[Rails] Re: Create and render a flash message partial?

2010-09-08 Thread Anders_P
Thanks! That worked. -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For

[Rails] Faking Paperclip has_attached_file with Factory girl?

2010-09-01 Thread Anders_P
Hello! I wonder if it's possible to simulate Paperclip's has_attached_file with Factory Girl and then test it with Rspec. I don't get it to work. My factories.rb file looks like this: Factory.define :user do |user| user.name Anders user.email u...@example.com

[Rails] Re: Faking Paperclip has_attached_file with Factory girl?

2010-09-01 Thread Anders_P
I solved it by defining :avatar_file_name in attr_accessor in my user model. Don't know if it's the best solution, comments? -- 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