[Rails] profile picture display in Heroku

2012-04-15 Thread Christopher Jones
Hi all, I have a rails application where users can upload profile pictures. Now this all works perfectly fine. Problem is I have recently uploaded my application to Heroku. It allows me to upload the image and actually states in the box what the image is but doesn't display it as it can't find the

[Rails] paginate with multiple criteria

2012-04-02 Thread Christopher Jones
I have pagination on my users table at the moment which works fine as I only have one search feature for users. But I now wish to add pagination to my games table but not sure how to implement it as I have 5 search features for games. I was wondering how I would go about adding the pagination to t

[Rails] Re: controller missing - locale

2012-04-02 Thread Christopher Jones
No worries, solved. -- 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 rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonr

[Rails] Re: controller missing - locale

2012-04-02 Thread Christopher Jones
Hi, I am receiving the following error: ArgumentError missing :controller Rails.root: C:/Users/Christopher/Favorites/safety/safety 11/games Application Trace | Framework Trace | Full Trace config/routes.rb:4:in `block (2 levels) in ' config/routes.rb:3:in `block in ' config/routes.rb:1:in `' T

[Rails] controller missing - locale

2012-03-29 Thread Christopher Jones
Hi all, I am having a problem at the moment with my code in which if I incase my routes with scope '(:locale)' do buy I get the error controller missing, any ideas why? Games::Application.routes.draw do scope '(:locale)' do get "game_interest/new" get "rules/index" get "feedback/index" ge

[Rails] Adding confirmed to a nearly complete rails application

2012-03-14 Thread Christopher Jones
I am coming to the end of my rails project now and I have done everything I wish to do apart from confirm the users account through email before creating it. I already have it to send an email to the user but I want the user to contain a link. It's far too late to add devise now as I already have a

[Rails] Re: Multiple search form error

2012-03-13 Thread Christopher Jones
All fixed now Colin, worked out the problem. -- 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 rubyonrails-talk@googlegroups.com. To unsubscribe from this grou

[Rails] Re: Multiple search form error

2012-03-13 Thread Christopher Jones
Hi Colin, I have made some progression. I have no changed the code a bit and the consearch works but none of the others do despite having the same code? My model is the same but my controller has changed to the following: @games = Game.gamsearch(params[:gamsearch]) @games = Game.gensearch(

[Rails] Re: Re: Multiple search form error

2012-03-13 Thread Christopher Jones
It is doing the correct action but doing it for all the text fields. If for instance I type good in to the second search field (search for genre) it will do so, but it will also produce the text in the other two search fields and search for good in genre and console and then only produce a resu

[Rails] Re: Multiple search form error

2012-03-13 Thread Christopher Jones
Hey Colin, By using my log and typing in each of the fields the same search I get the same results back in the log which is as followed: Started GET "/games?utf8=%E2%9C%93&search=good&commit=Search" for 127.0.0.1 at 2012-03-13 13:48:14 + Processing by GamesController#index as HTML Param

[Rails] Multiple search form error

2012-03-13 Thread Christopher Jones
I currently have these 3 search methods in my rails model, they are all the same apart from which field they search (take a look at the 5th line inside each method). def self.search(*args) return [] if args.blank? cond_text, cond_values = [], [] args.each do |str| next if str.blank? cond

[Rails] Re: Foreign keys in order to send email

2012-03-07 Thread Christopher Jones
Fixed my problem now. I changed the line: g = GameTrade.game_interest(email) to include user in the brackets to call the object. All I need to do now is to put the submit_tag in to a form in order to get it to actually work. -- Posted via http://www.ruby-forum.com/. -- You received this mes

[Rails] Re: Re: Re: Re: Foreign keys in order to send email

2012-03-07 Thread Christopher Jones
Colin Law wrote in post #1050581: > On 7 March 2012 16:08, Christopher Jones wrote: >>> >> >> Hey Colin >> >> What I have in my game_interest.rb is what I stated in an above post a >> few posts back. > > Please don't keep deleting the context.

[Rails] Re: Re: Re: Foreign keys in order to send email

2012-03-07 Thread Christopher Jones
Colin Law wrote in post #1050576: > On 7 March 2012 15:39, Christopher Jones wrote: >>> >> app/mailers/game_trade.rb:9:in `game_interest' >> >> But the second set of problems gives insight in to what the problem >> would be. The problem is line 19 in the

[Rails] Re: Re: Foreign keys in order to send email

2012-03-07 Thread Christopher Jones
> If it is not obvious which method it is complaining about then split > this into a number of lines, something like > user = @game.user > email = user.email > g = GameTrade.game_interest(email) > g.deliver > > and then you will see which line it fails on, assuming it is this bit > at all, but I as

[Rails] Re: Foreign keys in order to send email

2012-03-07 Thread Christopher Jones
I currently have the following in my games_controller for the show section so that when a user clicks on the button it does the following e.g. Jon(user 6) is interested in Adam(user 31) game. Jon clicks on adams game show page and clicks the interested button. The email should send to user 31's

[Rails] Re: Foreign keys in order to send email

2012-03-07 Thread Christopher Jones
Colin Law wrote in post #1050562: > On 7 March 2012 13:43, Christopher Jones wrote: >> associate the relationship between the two which is every game needs an >> users email to be sent to? > Assuming you have specified user has_many games and game belongs_to > user then if yo

[Rails] Foreign keys in order to send email

2012-03-07 Thread Christopher Jones
the users email as a foreign key in order for me to call the users email to be sent to? Any help would be much appreciated. Thank you Christopher Jones -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails:

[Rails] Re: User confirmation

2012-03-03 Thread Christopher Jones
Hey I have took a look at devise but most of my authentication has now been done through actual code rather than relying on gems. I was hoping for a non gem option as it is also a lot more beneficial in the sense of experience and getting to know rails. Any ideas of what would be possible. I ha

[Rails] User confirmation

2012-03-03 Thread Christopher Jones
Hi all, In my application I currently have the ability to create a user which then begins a session and sends an email confirmation to the email address. Whilst this is all good I wish to make it a little more advanced. What I wish to do is to have the ability of created the user and then the ema

[Rails] if current_user.id = game.user_id

2012-03-02 Thread Christopher Jones
Hi all, I have links to the show pages for each game in my project and if the games user_id matches the id of the currently signed in user then I want it to display the edit button if they are not then it shouldn't display. I currently have the following code set but it doesn't work. Every game h

[Rails] link_to alphabetical search

2012-02-29 Thread Christopher Jones
AdrianShaw (one of the users in my database) and click A it would return that exact user. What it seems to be doing is search but only for exact match results, anything less than the full word and it does not return. How would I go about doing this so that it gets all users with the first

[Rails] customise the color of link_to text

2012-02-29 Thread Christopher Jones
I have a section of link to button's in my index that have associated CSS which has a black background. Despite me in the css specifying the text to be the color white it is staying just plain black. How would I go about applying my own color to a link_to. My index section is as followed:

[Rails] Re: Re: Re: If photo field blank then?

2012-02-29 Thread Christopher Jones
Walter Davis wrote in post #1049480: > On Feb 29, 2012, at 10:31 AM, Christopher Jones wrote: > >>> >> Hey Walter, good shout. >> >> I don't know where it is getting that line from. > > Aha! That is coming from deep in the heart of Paperclip. You have

[Rails] Re: Re: If photo field blank then?

2012-02-29 Thread Christopher Jones
Walter Davis wrote in post #1049473: > On Feb 29, 2012, at 10:04 AM, Christopher Jones wrote: > >> >> <%= image_tag user.user_photo, :height => 50, :width => 50 %> >> >> I don't know what is stopping it from displaying the guest.png because >> i

[Rails] Re: If photo field blank then?

2012-02-29 Thread Christopher Jones
ow what is stopping it from displaying the guest.png because if I changed the line to photo.url.blank? then it will display the guest.png for every user but with the present or simply photo.url line it just doesn't display the guest.png for any of them. Thanks Christopher Jones -- Post

[Rails] Re: Re: Re: If photo field blank then?

2012-02-29 Thread Christopher Jones
Walter Davis wrote in post #1049458: > On Feb 29, 2012, at 9:20 AM, Christopher Jones wrote: > >> Hi, >> >> I done the above but I get the following error: >> >> undefined method `url?' for >> /photos/original/missing.png:Paperclip::Attachmen

[Rails] Re: Re: If photo field blank then?

2012-02-29 Thread Christopher Jones
> #models/user.rb > ... > def user_photo > (photo.url?) ? photo.url : 'default.png' > end > > And then in index.html.erb: > > <%= image_tag user.user_photo %> Hi, I done the above but I get the following error: undefined method `url?' for /photos/original/missing.png:Paperclip::Attachment An

[Rails] Re: If photo field blank then?

2012-02-29 Thread Christopher Jones
Walter Davis wrote in post #1049293: > On Feb 28, 2012, at 11:58 AM, Christopher Jones wrote: > >> the users. >> <%= link_to "Show", user %> >> >> <% end %> >> >> For the following line I want to do someth

[Rails] If photo field blank then?

2012-02-28 Thread Christopher Jones
Hi all, In my application all users have the ability to upload a profile picture through a file field but it is not compulsory. On my index page it displays all users along with their profile pictures but not all users have a profile picture and therefore some users have no image at all. How wou

[Rails] How would I go about running trace on the rails server?

2012-02-27 Thread Christopher Jones
I have tried the following but no luck: rails server --trace Thanks. -- 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 rubyonrails-talk@googlegroups.com. To

[Rails] Display associated record count

2012-02-25 Thread Christopher Jones
2 I was wondering if anyone knows how I would go about doing this. All I have managed so far is to display how many records are in that table. So that people know I have two separate tables for users and games. Thanks Christopher Jones -- Posted via http://www.ruby-forum.com

[Rails] Search of multiple columns

2012-02-21 Thread Christopher Jones
I am currently writing a search method for my rails applications and at the moment it works fine. I have the following in my game.rb: def self.search(search) if search find(:all, :conditions => ['game_name LIKE ? OR genre LIKE ? OR console LIKE ?', "%#{search}%", "#{search}", "#{search}"])

[Rails] Re: Re: Re: Re: Re: Re: Re: Display by alphabetical letter.

2012-02-20 Thread Christopher Jones
Colin Law wrote in post #1047891: > On 20 February 2012 21:43, Christopher Jones > wrote: >> >> Any ideas of what my problem might be? > > Have a look at the Rails Guide on Debugging for various debugging > techniques to help you work out why the code is not working.

[Rails] Re: Re: Re: Re: Re: Re: Display by alphabetical letter.

2012-02-20 Thread Christopher Jones
> But you're searching on a condition for games that contain the > character, instead of games that start with the character. What would I change to display by starting character? Also it does not seem to be searching it regardless because if for example I click the character X (a character that

[Rails] Re: Re: Re: Re: Re: Re: Display by alphabetical letter.

2012-02-20 Thread Christopher Jones
Colin Law wrote in post #1047882: > On 20 February 2012 19:36, Christopher Jones > wrote: >>> >>> >> I completed those two episodes. The first one I already use in the side >> bar for searching specific games and I have fully implemented the second >> ep

[Rails] Re: Re: Re: Re: Re: Display by alphabetical letter.

2012-02-20 Thread Christopher Jones
Javier Quarite wrote in post #1047871: > On Mon, Feb 20, 2012 at 2:09 PM, Christopher Jones > wrote: > >> <% end %> >> else >> Chris Jones >> >> > I haven't read the entire thread (just some parts) > > Maybe this is to b

[Rails] Re: Re: Re: Re: Display by alphabetical letter.

2012-02-20 Thread Christopher Jones
Ok so I have been playing around with this search for the past few hours and have done the following but still no result. I have the following in my index.html.erb: <% for char in 'A'..'Z' %> <%= link_to( "#{char}", :update => "content", :char =>

[Rails] Re: Re: Re: Display by alphabetical letter.

2012-02-20 Thread Christopher Jones
Started GET "/games?game_name=F" for 127.0.0.1 at 2012-02-20 11:53:51 + Creating scope :page. Overwriting existing method Game.page. Processing by GamesController#index as HTML Parameters: {"game_name"=>"Fifa 12"} [1m[36mGame Load (127.0ms)[0m [1mSELECT `games`.* FROM `games` LIMIT 4 O

[Rails] Re: Re: Display by alphabetical letter.

2012-02-19 Thread Christopher Jones
I shall check out those links, lately I have been listening to the casts on railscasts.org and they have proved very useful. Do you know of any good tutorials of using links to display associated records of a database? I tried the following but it does not work: <%= link_to 'f', games_path(:ga

[Rails] Re: Display by alphabetical letter.

2012-02-19 Thread Christopher Jones
Colin Law wrote in post #1047699: > On 19 February 2012 19:48, Christopher Jones > wrote: >> >> It will do this by searching the game_name column but only extracting >> those with the first letter not that of which it includes the letter >> anywhere in the name. &g

[Rails] Display by alphabetical letter.

2012-02-19 Thread Christopher Jones
only do one search for a page based on a column. I want it to be a search in which any letter can be clicked and then will link you to associated games. I am a new user of rails so any support would be of help. Thanks Christopher Jones -- Posted via http://www.ruby-forum.com/. -- You received

[Rails] Re: SMTP problem.

2012-02-17 Thread Christopher Jones
> @full_message = < To: t...@gmail.com > Subject: its working! > > > This is a sample message > > MESSAGE_END So the above is your text.rb message? > @sent=0 >smtp = Net::SMTP.new('smtp.gmail.com', 25) >smtp.enable_starttls > > smtp.start('mail.google.com',username, password, :login) d

[Rails] Multiple search methods

2012-02-16 Thread Christopher Jones
Hi all, I am wondering if any of you know how to make multiple search methods in one model? currently I have a search method that has been declared in the model, but I want to create another separate search for different criteria in the database table. How would I do that? I currently have the fo

[Rails] Re: Re: SMTP problem.

2012-02-14 Thread Christopher Jones
I have the following in my user_mailer.rb similar to you but it doesn't seem to work for me: class UserMailer < ActionMailer::Base default :from => "notificati...@example.com" def registration_confirmation(user) @user = user @url = "http://localhost:3000"; mail(:to => user.email

[Rails] Re: SMTP problem.

2012-02-14 Thread Christopher Jones
> ActionMailer::Base.smtp_settings = { > :address => "address", > :port => "port", > :user_name=> "email", > :password => "password", > :authentication => "plain", > :enable_starttls_auto => true Hey Javier, I added the above s

[Rails] SMTP problem.

2012-02-14 Thread Christopher Jones
Hey all, well I am trying to send emails to newly created users but I have a problem. In the rails log it states that the email has been sent but the email is never actually received so obviously there is a problem. I have noticed one in particular and I don't understand how to fix it. Once I cre

[Rails] Re: Delete :confirm => "Sure?"

2012-02-14 Thread Christopher Jones
> <%= javascript_include_tag "application" %> That line worked great Pete, It is all sorted now. Just wondering why it works with the "application" and not the :all? Thanks. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups

[Rails] Delete :confirm => "Sure?"

2012-02-13 Thread Christopher Jones
Hey all, well I have a delete function in my rails application that works successfully. When I click the button it deletes the record from the page as well as the database, my problem is that I don't want it to instantaneously do this, I want it to give the user the option to cancel before hand. Ho

[Rails] Re: Re: Re: Multiple feature creation.

2012-02-10 Thread Christopher Jones
That makes total sense, how would it be able to be created if it demanded presence. I tried it without the mandatory validation and it worked. Thanks for all the help Walter, appreciate it a lot. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribe

[Rails] Re: Re: Multiple feature creation.

2012-02-10 Thread Christopher Jones
Walter Davis wrote in post #1045281: > On Feb 10, 2012, at 3:57 PM, Christopher Jones wrote: > >> >> contain between 8 to 20 characters" >>def encrypt_password >> BCrypt::Engine.hash_secret(password, user.password_salt) >> class Wishlist

[Rails] Re: Multiple feature creation.

2012-02-10 Thread Christopher Jones
This is my user model: class User < ActiveRecord::Base has_one :profile has_many :games has_one :wishlist attr_accessor :password before_save :encrypt_password validates_presence_of :username validates_length_of :username, :within => 6..20, :message => "must contain between 6 to

[Rails] Re: Re: Re: Re: Re: Re: Re: Re: Multiple feature creation.

2012-02-10 Thread Christopher Jones
> before_create :assign_wishlist > > private > def assign_wishlist > self.wishlist = Wishlist.create > end I placed the above in the user.rb (Is that correct or should it be wishlist.rb?) and It created the account but after looking at the log there was nothing about creating the wis

[Rails] Re: Re: Re: Re: Re: Re: Re: Multiple feature creation.

2012-02-10 Thread Christopher Jones
I know that the correct user is being signed in because certain elements such as adding a product etc. get created based on who is signed in and therefore associates the id of the product with them so that they get displayed under the profile. The wishlist should be created when I create the us

[Rails] Re: Re: Re: Re: Re: Re: Multiple feature creation.

2012-02-10 Thread Christopher Jones
> And just to confirm, you are doing this in the user controller, right? Yes this is all happening in the user model > What do your models look like for wishlist and user then? If you have > defined the has_many belongs_to relationship, then the one-liner I > showed you: My user model has a: has

[Rails] Re: Re: Re: Re: Re: Multiple feature creation.

2012-02-09 Thread Christopher Jones
> That one-liner ought to Just Work. > > Walter I have my code like this but I just doesn't seem to generate a wishlist :( before_filter :set_wishlist, :only => :create def set_wishlist @wishlist = Wishlist.create(params[:wishlist]) @wishlist.user = current_user @wishlist.save e

[Rails] Re: Re: Re: Re: Multiple feature creation.

2012-02-09 Thread Christopher Jones
Hey Walter, I have the following in my userController after_filter :set_wishlist, :only => :create def set_wishlist @wishlist = Wishlist.new(params[:wishlist]) @wishlist.user = current_user end It goes ahead but doesn't actually create a wishlist for the user. I checked in the serv

[Rails] Re: Re: Re: Multiple feature creation.

2012-02-09 Thread Christopher Jones
By stating params in the model as def set_wishlist(params) It returns the error of: wrong number of arguments (0 of 1). If I was to try and call the create method from wishlistController through the user model, how would I go about calling it? I have not had he experience of doing such thing b

[Rails] Re: Re: Multiple feature creation.

2012-02-09 Thread Christopher Jones
Hi, I tried the method that I stated in the model: def set_wishlist @wishlist = Wishlist.new(params[:wishlist]) end But once I created the user it returned an error screen stating: NameError in UsersController#create undefined local variable or method `params' for # Rails.root: C:/finalprojec

[Rails] Re: Multiple feature creation.

2012-02-09 Thread Christopher Jones
> Use an after_create callback in the User model to create the associated > Wishlist record. So in the user model would I define first like this: after_create :set_wishlist then the following: def set_wishlist @wishlist = Wishlist.new(params[:wishlist]) end I hope I am on the correct track.

[Rails] Re: Re: Ruby on Rails Hosting.

2012-02-08 Thread Christopher Jones
I am currently using MySQL as my database, I am guessing I will have to re configure it all then? -- 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 rubyonrail

[Rails] Multiple feature creation.

2012-02-08 Thread Christopher Jones
Hi all I wondering how I would go about generating multiple features on user creation. I want every user who signs up to have a wishlist automatically which is a separate to the actual users (different model/view/controller etc.) On user create I want it to create a user as well as create a wishli

[Rails] Re: Ruby on Rails Equality

2012-02-07 Thread Christopher Jones
Been working on it this afternoon guys and made a fair few tweaks and it has resulted in success. Thanks for all the help guys. -- 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

[Rails] Ruby on Rails Equality

2012-02-07 Thread Christopher Jones
Hi all, Just wondering about equality in rails for access to certain features such as the following. I have a table for games and all users are able to click on the show button to display the actual record. On the show page it has the options to go back or edit. I want to do the following If the

[Rails] Re: Re: Re: Display by Timestamps?

2012-02-06 Thread Christopher Jones
Cheers for all the help, it worked a treat. :) -- 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 rubyonrails-talk@googlegroups.com. To unsubscribe from this gr

[Rails] Re: Re: Display by Timestamps?

2012-02-06 Thread Christopher Jones
> Game.all().order('created_at desc').limit(5) So would this go in my index.html as the following? <% Game.all().order('created_at desc').limit(5) %> or does it go in the model? Thanks -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the G

[Rails] Re: Display by Timestamps?

2012-02-06 Thread Christopher Jones
> Maybe you don't know about the limit clause? I had never previously heard of it but just done some research. Is this the sort of thing you mean? Game.find(:all, :limit => 5, :order=> 'created_at') ? Thanks -- Posted via http://www.ruby-forum.com/. -- You received this message because you

[Rails] Display by Timestamps?

2012-02-06 Thread Christopher Jones
Hi All, I am wondering if anyone has any information on displaying records based on their timestamp. I want to on the front page of the website display the 3 most recently uploaded games. I imagine I would do this by extracting the three games with the most recent timestamp? Any information/link

[Rails] Ruby on Rails Hosting.

2012-02-06 Thread Christopher Jones
Hey all, I am currently doing my dissertation project and am extremely far in to the process and am ready to host it external of my university due to my university not having Ruby on Rails support on their servers. I am wondering if anyone knows of any free hosting sites for ruby on rails that wo

[Rails] Re: Re: Re: User and Game Association help.

2012-02-01 Thread Christopher Jones
> Apologies to Christopher for casting aspersions on his code. That's fine Colin, we all make mistakes, myself in particular :) It is all functioning well at the moment, just need to make a few validation checks etc. The tutorials are great also, done many of them through the book Agile Web De

[Rails] Re: Re: User and Game Association help.

2012-02-01 Thread Christopher Jones
Hey Colin, I fixed it :) Stupid me, I simply added the following line to my create method in the controller. @game.user = current_user Now I just need to figure out a way of displaying the actual games under the profiles so that other users can view. One wall down, another wall to go. -- Po

[Rails] Re: Re: User and Game Association help.

2012-02-01 Thread Christopher Jones
Ok thanks. Do you have any tutorials to recommend it regards to my problem? That would be great help. Thanks. -- 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

[Rails] Re: User and Game Association help.

2012-02-01 Thread Christopher Jones
> If you have a user, current_user for example, then his games will be > current_user.games. At the moment I have under the profile @user.games that should return all games associated with that particular user but no results. I would like it so that when a new game is added it will associate it

[Rails] User and Game Association help.

2012-01-31 Thread Christopher Jones
Hi all, I am currently doing work on my rails project and have hit a wall. I am quite new to Rails so at the moment only know a little bit about it. I have a users table and a games table. At the moment I am able to enter in user information as well as add new games to the games table. What I wis